modified tokenizer to not break on on ]]] at the end of a style

This commit is contained in:
Nils Andresen
2022-10-23 21:07:10 +02:00
committed by Patrik Svensson
parent 4258cbfb85
commit f895bb175d
2 changed files with 60 additions and 19 deletions

View File

@ -154,5 +154,25 @@ public partial class AnsiConsoleTests
// Then
console.Output.ShouldBe("[grey][white]");
}
[Theory]
[InlineData("[white][[[/][white]]][/]", "[]")]
[InlineData("[white][[[/]", "[")]
[InlineData("[white]]][/]", "]")]
[InlineData("[black on white link=https://www.gooole.com/q=]]]Search for a bracket[/]", "Search for a bracket")]
[InlineData("[link=https://www.gooole.com/q=]] black on white]Search for a bracket[/]", "Search for a bracket")]
[InlineData("[link]https://www.gooole.com/q=]][/]", "https://www.gooole.com/q=]")]
public void Should_Not_Fail_As_In_GH1024(string markup, string expected)
{
// Given
var console = new TestConsole();
console.EmitAnsiSequences = false;
// When
console.Markup(markup);
// Then
console.Output.ShouldBe(expected);
}
}
}