Fix parsing html tags with starting with slash

This commit is contained in:
Wojciech Figat
2022-08-03 10:15:42 +02:00
parent e59de73948
commit dbd48ac5b4
2 changed files with 46 additions and 13 deletions

View File

@@ -68,8 +68,27 @@ namespace FlaxEngine.Tests
return result;
}
[TestCase("b<a>", ExpectedResult = false)]
[TestCase("b<a/>", ExpectedResult = true)]
[TestCase("b<a />", ExpectedResult = true)]
[TestCase("b<a />", ExpectedResult = true)]
[TestCase("b<a size=50>", ExpectedResult = false)]
[TestCase("b<a size=50/>", ExpectedResult = true)]
[TestCase("b</a>", ExpectedResult = true)]
public bool TestEnding(string html)
{
var parser = new HtmlParser(html);
while (parser.ParseNext(out var tag))
{
return tag.IsSlash;
}
throw new System.Exception();
}
[TestCase("b<a size=50>", ExpectedResult = 1)]
[TestCase("sd b <a>", ExpectedResult = 5)]
[TestCase("sd b </a>", ExpectedResult = 5)]
[TestCase("sd b <a/>", ExpectedResult = 5)]
public int TestStartPosition(string html)
{
var parser = new HtmlParser(html);