예제 #1
0
        public void ShouldReportAndErrorOnEmptyTags()
        {
            var parser = new CustomParser();

            parser.RegisterEmptyTag("hello", (w, e, c) =>
            {
                w.Write("Hello World");

                return(Statement.Normal());
            });

            Assert.Throws <ParseException>(() => parser.Parse("{% hello foo %}"));
        }
예제 #2
0
        public void ShouldRenderEmptyTags()
        {
            var parser = new CustomParser();

            parser.RegisterEmptyTag("hello", (w, e, c) =>
            {
                w.Write("Hello World");

                return(Statement.Normal());
            });

            var template = parser.Parse("{% hello %}");
            var result   = template.Render();

            Assert.Equal("Hello World", result);
        }