Skip to content

Commit

Permalink
add unit test for serilog#1353
Browse files Browse the repository at this point in the history
  • Loading branch information
martinh2011 authored and Twinki14 committed Dec 30, 2023
1 parent 6be463a commit 6da9821
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Serilog.Tests/Parsing/MessageTemplateParserTests.cs
Expand Up @@ -171,5 +171,23 @@ public void IndexOutOfRangeExceptionBugHasNotRegressed()
var parser = new MessageTemplateParser();
parser.Parse("{,,}");
}

[Fact]
public void Bug1353FormatStringIsParsedCorrectly()
{
AssertParsedAs("{0,-25} {1,10:#,##0} {2,10:#,##0} {3,10:+#,##0;-#,##0;0} {4,10:0.00}",
new PropertyToken("0","{0,-25}", startIndex:0),
new TextToken(" ", startIndex:7),
new PropertyToken("1","{1,10:#,##0}", "#,##0", startIndex:8),
new TextToken(" ", startIndex:20),
new PropertyToken("2","{2,10:#,##0}", "#,##0", startIndex:21),
new TextToken(" ", startIndex:33),
new PropertyToken("3","{3,10:+#,##0;-#,##0;0}", "+#,##0;-#,##0;0", startIndex:34),
new TextToken(" ", startIndex:56),
new PropertyToken("4","{4,10:0.00}", "0.00", startIndex:57)
);
}


}
}

0 comments on commit 6da9821

Please sign in to comment.