public void It_Can_Pass_Parse_Arguments() { var result1 = MustacheParser.Parse("Test {{Foo}} Test 1"); var result2 = MustacheParser.Parse("Test {{Foo}} Test 3", new Tags("{{", "}}")); Assert.NotEmpty(result1.Children); Assert.NotEmpty(result2.Children); }
public void It_Knows_How_To_Parse(TestData data) { OutputStream.WriteLine($"Index: {data.Index}, Template: '{data.Name}'"); var results = MustacheParser.Parse(data.Name); Assert.Equal("Root", results.Identifier); Assert.Equal(data.Arguments.Count, results.Children.Count); for (var i = 0; i < results.Children.Count; i++) { Assert.StrictEqual(data.Arguments[i], results.Children[i]); } }
public void Static_MustacheParser_Throws_On_Null() { Assert.Throws <ArgumentNullException>(() => MustacheParser.Parse(null)); }
public void It_Errors_When_You_Close_The_Wrong_Section() { var ex = Assert.Throws <StubbleException>(() => { MustacheParser.Parse("{{#Section}}Herp De Derp{{/WrongSection}}"); }); Assert.Equal("Cannot close Block 'WrongSection' at 24. There is already an unclosed Block 'Section'", ex.Message); }
public void It_Knows_When_There_Is_An_Unopened_Section() { var ex = Assert.Throws <StubbleException>(() => { MustacheParser.Parse("The end of the list! {{/people}}"); }); Assert.Equal("Unopened Block 'people' at 21", ex.Message); }
public void It_Knows_When_There_Is_An_Unclosed_Section() { var ex = Assert.Throws <StubbleException>(() => { MustacheParser.Parse("A list: {{#people}}{{Name}}"); }); Assert.Equal("Unclosed Block 'people' at 27", ex.Message); }
public void It_Knows_When_There_Is_An_Unclosed_Tag() { var ex = Assert.Throws <StubbleException>(() => { MustacheParser.Parse("My Name is {{Name"); }); Assert.Equal("Unclosed Tag at 17", ex.Message); }
public void NonRegexParser() { MustacheParser.Parse(template); }