-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9db1089
commit 7b006a0
Showing
6 changed files
with
85 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,57 @@ | ||
using RueI; | ||
using RueI.Parsing; | ||
using RueI.Parsing.Tags; | ||
using System.Linq; | ||
|
||
namespace RueITest | ||
namespace RueITest; | ||
|
||
[RichTextTag] | ||
public class NotTag | ||
{ | ||
} | ||
|
||
[RichTextTag] | ||
public class RealTag : NoParamsTag | ||
{ | ||
[TestClass] | ||
public class TestTags | ||
public override string[] Names { get; } = { "hello" }; | ||
|
||
public override bool HandleTag(ParserContext context) => throw new NotImplementedException(); | ||
} | ||
|
||
[TestClass] | ||
public class TestTags | ||
{ | ||
[TestMethod] | ||
public void TestTagBuilding() | ||
{ | ||
[TestMethod] | ||
public void TestUtility() | ||
{ | ||
string? shouldExist = TagHelpers.ExtractFromQuotations("hello world"); | ||
string? shouldExist2 = TagHelpers.ExtractFromQuotations("\"hello world - - - again\""); | ||
ParserBuilder builder = new(); | ||
|
||
string? shouldNull = TagHelpers.ExtractFromQuotations("\"hello !!! \nworld"); | ||
string? shouldNull2 = TagHelpers.ExtractFromQuotations("hello world again\""); | ||
builder.AddFromAssembly(typeof(TestTags).Assembly); | ||
Parser parser = builder.Build(); | ||
|
||
Assert.IsNotNull(shouldExist); | ||
Assert.IsNotNull(shouldExist2); | ||
Assert.AreEqual(1, parser.Tags.Count); | ||
Assert.IsTrue(parser.Tags.Values.Any(x => x.Contains(SharedTag<RealTag>.Singleton))); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow("\"hello !!! \nworld")] | ||
[DataRow("hello world again\"")] | ||
public void TestQuoteFailures(string input) | ||
{ | ||
string? shouldNull = TagHelpers.ExtractFromQuotations(input); | ||
|
||
Assert.IsNull(shouldNull); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow("\"hello world - - - again\"")] | ||
[DataRow("hello \n\n\nworld")] | ||
[DataRow("\"y")] | ||
public void TestQuoteSuccess(string input) | ||
{ | ||
string? shouldExist = TagHelpers.ExtractFromQuotations(input); | ||
|
||
Assert.IsNull(shouldNull); | ||
Assert.IsNull(shouldNull2); | ||
} | ||
Assert.IsNotNull(shouldExist); | ||
} | ||
} | ||
} | ||
///"\"hello world - - - again\"" |