Ejemplo n.º 1
0
        public static IList <TestDescriptor> GetLoopTagsTests()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();

            // CYCLE TAG
            lst.Add(new TestDescriptor("cycle01", "{% cycle a %}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.RenderingException))));
            lst.Add(new TestDescriptor("cycle02", "{% cycle a,b,c as abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("ab")));
            lst.Add(new TestDescriptor("cycle03", "{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("abc")));
            lst.Add(new TestDescriptor("cycle04", "{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("abca")));
            lst.Add(new TestDescriptor("cycle05", "{% cycle %}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("cycle06", "{% cycle a %}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.RenderingException))));
            lst.Add(new TestDescriptor("cycle07", "{% cycle a,b,c as foo %}{% cycle bar %}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.RenderingException))));
            lst.Add(new TestDescriptor("cycle08", "{% cycle a,b,c as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}", ContextObjects.empty, ContextObjects.p("abbbcc")));
            lst.Add(new TestDescriptor("cycle09", "{% for i in test %}{% cycle a,b %}{{ i }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("a0,b1,a2,b3,a4,")));
            lst.Add(new TestDescriptor("cycle09-1", "{% for i in test %}{% cycle a,b %}{{ i.0 }};{{i.1}},{% endfor %}", ContextObjects.p("test", ContextObjects.square(5, 2)), ContextObjects.p("a0-0;0-1,b1-0;1-1,a2-0;2-1,b3-0;3-1,a4-0;4-1,")));
            lst.Add(new TestDescriptor("cycle09-2", "{% for i, j in test %}{% cycle a,b %}{{ i }};{{j}},{% endfor %}", ContextObjects.p("test", ContextObjects.square(5, 2)), ContextObjects.p("a0-0;0-1,b1-0;1-1,a2-0;2-1,b3-0;3-1,a4-0;4-1,")));
            lst.Add(new TestDescriptor("cycle09-3", "{% for i,j in test %}{% cycle a,b %}{{ i }};{{j}},{% endfor %}", ContextObjects.p("test", ContextObjects.square(5, 2)), ContextObjects.p("a0-0;0-1,b1-0;1-1,a2-0;2-1,b3-0;3-1,a4-0;4-1,")));

            //// New format,
            lst.Add(new TestDescriptor("cycle10-1", "{% cycle 'a' 'b' 'c' as abc %}", ContextObjects.empty, ContextObjects.p("a")));
            lst.Add(new TestDescriptor("cycle10", "{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("ab")));
            lst.Add(new TestDescriptor("cycle11", "{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("abc")));
            lst.Add(new TestDescriptor("cycle12", "{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}", ContextObjects.empty, ContextObjects.p("abca")));
            lst.Add(new TestDescriptor("cycle13", "{% for i in test %}{% cycle 'a' 'b' %}{{ i }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("a0,b1,a2,b3,a4,")));
            lst.Add(new TestDescriptor("cycle14", "{% cycle one two as foo %}{% cycle foo %}", ContextObjects.p("one", "1", "two", "2"), ContextObjects.p("12")));
            lst.Add(new TestDescriptor("cycle13", "{% for i in test %}{% cycle aye bee %}{{ i }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5), "aye", "a", "bee", "b"), ContextObjects.p("a0,b1,a2,b3,a4,")));

            // for tag
            lst.Add(new TestDescriptor("for 01", "{% for i in test %}{% cycle aye bee %}{{ i }}hide this{% empty %}show this{% endfor %}", ContextObjects.p("test", null, "aye", "a", "bee", "b"), ContextObjects.p("show this")));
            lst.Add(new TestDescriptor("for 02", "{% for i in test %}{{ forloop.counter }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("1,2,3,4,5,")));
            lst.Add(new TestDescriptor("for 03", "{% for i in test %}{{ forloop.revcounter0 }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("4,3,2,1,0,")));
            lst.Add(new TestDescriptor("for 04", "{% for athlete in athleteList %}{{ athlete.name }},{% endfor %}", ContextObjects.p("athleteList", new AthleteList()), ContextObjects.p("Michael Jordan,Magic Johnson,")));
            lst.Add(new TestDescriptor("for 05", "{% for FirstName, LastName in athleteList %}{{ FirstName }} {{ LastName }},{% endfor %}", ContextObjects.p("athleteList", new AthleteList()), ContextObjects.p("Michael Jordan,Magic Johnson,")));
            lst.Add(new TestDescriptor("for 06", "{% for FirstName, LastName in athleteList %}{{ FirstName }} {{ LastName }},{% endfor %}",
                                       ContextObjects.p("athleteList", new string[][] { new string[] { "Michael", "Jordan" }, new string[] { "Magic", "Johnson" } }),
                                       ContextObjects.p("Michael Jordan,Magic Johnson,")));
            lst.Add(new TestDescriptor("for 07", "{% for athlete in athleteList reversed %}{{ athlete.name }},{% endfor %}", ContextObjects.p("athleteList", new AthleteList()), ContextObjects.p("Magic Johnson,Michael Jordan,")));
            lst.Add(new TestDescriptor("for 08", "{% for FirstName, LastName in athleteList %}{% if forloop.last %}{{ FirstName }} {{ LastName }}{% endif %}{% endfor %}",
                                       ContextObjects.p("athleteList", new string[][] { new string[] { "Michael", "Jordan" }, new string[] { "Magic", "Johnson" } }),
                                       ContextObjects.p("Magic Johnson")));
            lst.Add(new TestDescriptor("for 09", "{% for i in test %}run {{ forloop.counter }}:{% for j in test%}i={{forloop.parentloop.counter}},j={{forloop.counter}};{% endfor %}{% endfor %}",
                                       ContextObjects.p("test", ContextObjects.range(2)),
                                       ContextObjects.p("run 1:i=1,j=1;i=1,j=2;run 2:i=2,j=1;i=2,j=2;")));

            // ifchanged tag
            lst.Add(new TestDescriptor("ifchanged 01", "{% for i in test %}{% ifchanged %}nothing changed{%else%}same {% endifchanged %}{{ forloop.counter }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("nothing changed1,same 2,same 3,same 4,same 5,")));
            lst.Add(new TestDescriptor("ifchanged 02", "{% for i in test %}{% ifchanged a %}nothing changed{% endifchanged %}{{ forloop.counter }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("nothing changed1,2,3,4,5,")));
            lst.Add(new TestDescriptor("ifchanged 03", "{% for i in test %}{% ifchanged %}counter = {{ forloop.counter }}{% else %} hide this {% endifchanged %}{{ forloop.counter }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("counter = 11,counter = 22,counter = 33,counter = 44,counter = 55,")));
            lst.Add(new TestDescriptor("ifchanged 04", "{% for i in test %}{% ifchanged i %}counter = {{ forloop.counter }}{% endifchanged %}{{ forloop.counter }},{% endfor %}", ContextObjects.p("test", ContextObjects.range(5)), ContextObjects.p("counter = 11,counter = 22,counter = 33,counter = 44,counter = 55,")));
            return(lst);
        }
Ejemplo n.º 2
0
        public IList <TestDescriptor> GetReproducedIssues()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();



            List <string> lstIssue219bisBig = GetAHrefs(5000);



            lst.Add(new TestDescriptor("issue219-bisBig",
                                       lstIssue219bisBig[0],
                                       ContextObjects.p(
                                           "root", "http://www.hill30.com",
                                           "revision", ContextObjects.dictStr("DrugCategoryId", 12,
                                                                              "ScriptRevisionId", 123,
                                                                              "DrugId", 1234,
                                                                              "EntryPointId", 12345,
                                                                              "ScriptRevisionType", 123456)), ContextObjects.p(lstIssue219bisBig[1])));



            List <string> lstIssue219 = GetAHrefs(40);


            lst.Add(new TestDescriptor("issue219",
                                       lstIssue219[0],
                                       ContextObjects.p(
                                           "root", "http://www.hill30.com",
                                           "revision", ContextObjects.dictStr("DrugCategoryId", 12,
                                                                              "ScriptRevisionId", 123,
                                                                              "DrugId", 1234,
                                                                              "EntryPointId", 12345,
                                                                              "ScriptRevisionType", 123456)),
                                       ContextObjects.p(lstIssue219[1])));

            List <string> lstIssue219Bis = GetAHrefs(4);

            lst.Add(new TestDescriptor("issue219-bis",
                                       lstIssue219Bis[0],
                                       ContextObjects.p(
                                           "root", "http://www.hill30.com",
                                           "revision", ContextObjects.dictStr("DrugCategoryId", 12,
                                                                              "ScriptRevisionId", 123,
                                                                              "DrugId", 1234,
                                                                              "EntryPointId", 12345,
                                                                              "ScriptRevisionType", 123456)), ContextObjects.p(lstIssue219Bis[1])));

            return(lst);
        }
Ejemplo n.º 3
0
        public static IList <TestDescriptor> GetIfTagTests()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();

            // ### SMART IF TAG ################################################################
            lst.Add(new TestDescriptor("if-tag < 01", "{% if foo < bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 1, "bar", 2), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag < 02", "{% if foo < bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 1, "bar", 1), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag < 03", "{% if foo < bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 2, "bar", 1), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag < 04", "{% if foo > bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 1, "bar", 2), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag < 05", "{% if foo == bar %}yes{%else %}no{% endif %}", ContextObjects.p("foo", 1, "bar", 2), ContextObjects.p("no")));

            // AND and OR raised a TemplateSyntaxError in django 1.1 but we can use OR and AND in one expression since django 1.2
            lst.Add(new TestDescriptor("if-tag-orand", "{% if foo or bar and baz %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-andor", "{% if foo and bar or baz %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "baz", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-andand", "{% if foo and bar and baz %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true, "baz", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag->and", "{% if foo > bar and baz %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 3, "bar", 2, "baz", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag->and<", "{% if foo > bar and baz < bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", 3, "bar", 2, "baz", 1), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not-or-and01", "{% if foo or not bar and baz  %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false, "baz", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not-or-and02", "{% if foo or not bar and baz  %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false, "baz", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not-or-and03", "{% if foo or not bar and baz  %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true, "baz", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not-or-and04", "{% if foo or not bar and baz  %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false, "baz", false), ContextObjects.p("no")));

            // ### IF TAG ################################################################
            lst.Add(new TestDescriptor("if-tag01", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag02", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag02-1", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", null), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag03", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));

            // AND
            lst.Add(new TestDescriptor("if-tag-and01", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-and02", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and03", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and04", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and05", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and06", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and07", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and08", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", true), ContextObjects.p("no")));

            // OR
            lst.Add(new TestDescriptor("if-tag-or01", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or02", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or03", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or04", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or05", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or06", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or07", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or08", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", true), ContextObjects.p("yes")));

            // TODO, multiple ORs

            // NOT
            lst.Add(new TestDescriptor("if-tag-not01", "{% if not foo %}no{% else %}yes{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not02", "{% if not %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not03", "{% if not %}yes{% else %}no{% endif %}", ContextObjects.p("not", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not04", "{% if not not %}no{% else %}yes{% endif %}", ContextObjects.p("not", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not05", "{% if not not %}no{% else %}yes{% endif %}", ContextObjects.p(), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not06", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not07", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not08", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not09", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not10", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not11", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not12", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not13", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not14", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not15", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not16", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not17", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not18", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not19", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not20", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not21", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not22", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not23", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not24", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not25", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not26", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not27", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not28", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not29", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not30", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not31", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not32", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not33", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not34", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not35", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));



            lst.Add(new TestDescriptor("if-tag-error01", "{% if foo and %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error02", "{% if foo or %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error03", "{% if not foo and %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error04", "{% if not foo or %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error05", "{% if not foo %}yes{% else %}no", ContextObjects.p("foo", true), ContextObjects.p(typeof(Interfaces.SyntaxException))));

            // IFEqual TAG
            lst.Add(new TestDescriptor("ifequal-tag-01", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-02", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("ifequal-tag-03", "{% ifnotequal foo bar %}yes{% else %}no{% endifnotequal %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("ifequal-tag-04", "{% ifnotequal foo bar %}yes{% else %}no{% endifnotequal %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-05", "{% ifequal foo \"true\" %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", "true"), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-06", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", "true", "bar", false), ContextObjects.p("no")));

            return(lst);
        }
Ejemplo n.º 4
0
        public static IList <TestDescriptor> GetBasicTests()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();

            //*
            // Plain text should go through the template parser untouched
            lst.Add(new TestDescriptor("basic-syntax01", "something cool", null, ContextObjects.p("something cool")));
            // Variables should be replaced with their value in the current context
            lst.Add(new TestDescriptor("basic-syntax02", "{{ headline }}", ContextObjects.p("headline", "Success"), ContextObjects.p("Success"), "headline"));
            Guid guid = Guid.NewGuid();

            lst.Add(new TestDescriptor("basic-syntax02", "{{ headline }}", ContextObjects.p("headline", guid), ContextObjects.p(guid.ToString()), "headline"));

            // More than one replacement variable is allowed in a template
            lst.Add(new TestDescriptor("basic-syntax03", "{{ first }} --- {{ second }}", ContextObjects.p("first", 1, "second", 2),
                                       ContextObjects.p("1 --- 2"), "first", "second"));
            int?p2 = null;

            lst.Add(new TestDescriptor("basic-syntax03-1", "{{ first }} --- {{ second }}", ContextObjects.p("first", null, "second", p2), ContextObjects.p(" --- ")));

            // Fail silently when a variable is not found in the current context
            lst.Add(new TestDescriptor("basic-syntax04", "as{{ missing }}df", ContextObjects.empty, ContextObjects.p("asdf", "asINVALIDdf")));

            // A variable may not contain more than one word
            lst.Add(new TestDescriptor("basic-syntax06", "{{ multi word variable }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));

            // A variable may has to have a reference variable first
            lst.Add(new TestDescriptor("basic-syntax06-1", "{{ |filter }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));

            // Raise TemplateSyntaxError for ContextObjects.empty variable tags
            lst.Add(new TestDescriptor("basic-syntax07", "{{ }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("basic-syntax08", "{{        }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));

            // Attribute syntax allows a template to call an object's attribute
            lst.Add(new TestDescriptor("basic-syntax09", "{{ var.method }}", ContextObjects.p("var", new ContextObjects.SomeClass()), ContextObjects.p("SomeClass.method")));

            // Multiple levels of attribute access are allowed
            lst.Add(new TestDescriptor("basic-syntax10", "{{ var.otherclass.method }}", ContextObjects.p("var", new ContextObjects.SomeClass()),
                                       ContextObjects.p("OtherClass.method"), "var.otherclass.method"));

            // Multiple levels of attribute access are allowed
            lst.Add(new TestDescriptor("basic-syntax10-l", "{{ var.classList.0.method }} {% for oc in var.classList %}{{forloop.counter}} = {{oc.method}};{%endfor%}", ContextObjects.p("var", new ContextObjects.SomeClass()),
                                       ContextObjects.p("Instance 1 1 = Instance 1;2 = Instance 2;"), "var.otherclass.method"));

            // Fail silently when a variable's attribute isn't found
            lst.Add(new TestDescriptor("basic-syntax11", "{{ var.blech }}", ContextObjects.p("var", new ContextObjects.SomeClass()), ContextObjects.p("", "INVALID")));

            // Raise TemplateSyntaxError when trying to access a variable beginning with an underscore
            //lst.Add(new TestDescriptor("basic-syntax12", "{{ var.__dict__ }}", ContextObjects.p("var", new ContextObjects.SomeClass()), ContextObjects.p(typeof(SyntaxException))));

            // Raise TemplateSyntaxError when trying to access a variable containing an illegal character
            lst.Add(new TestDescriptor("basic-syntax13", "{{ va>r }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("basic-syntax14", "{{ (var.r) }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("basic-syntax15", "{{ sp%am }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("basic-syntax16", "{{ eggs! }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));
            lst.Add(new TestDescriptor("basic-syntax17", "{{ moo? }}", ContextObjects.empty, ContextObjects.p(typeof(Interfaces.SyntaxException))));

            var d = new Dictionary <string, string>();

            d.Add("bar", "baz");

            // Attribute syntax allows a template to call a dictionary key's value
            lst.Add(new TestDescriptor("basic-syntax18", "{{ foo.bar }}", ContextObjects.p("foo", d), ContextObjects.p("baz")));

            // Fail silently when a variable's dictionary key isn't found
            lst.Add(new TestDescriptor("basic-syntax19", "{{ foo.spam }}", ContextObjects.p("foo", d), ContextObjects.p("", "INVALID")));

            // Fail silently when accessing a non-simple method
            lst.Add(new TestDescriptor("basic-syntax20", "{{ var.method2 }}", ContextObjects.p("var", new ContextObjects.SomeClass()), ContextObjects.p("", "INVALID")));

            // Don't get confused when parsing something that is almost, but not
            // quite, a template tag.
            lst.Add(new TestDescriptor("basic-syntax21", "a {{ moo %} b", ContextObjects.empty, ContextObjects.p("a {{ moo %} b")));
            lst.Add(new TestDescriptor("basic-syntax22", "{{ moo //}", ContextObjects.empty, ContextObjects.p("{{ moo //}")));

            // Will try to treat "moo //} {{ cow" as the variable. Not ideal, but
            // costly to work around, so this triggers an error.
            lst.Add(new TestDescriptor("basic-syntax23", "{{ moo //} {{ cow }}", ContextObjects.p("cow", "cow"), ContextObjects.p(typeof(Interfaces.SyntaxException))));

            // Embedded newlines make it not-a-tag.
            lst.Add(new TestDescriptor("basic-syntax24", "{{ moo\n }}", ContextObjects.empty, ContextObjects.p("{{ moo\n }}")));

            // Literal strings are permitted inside variables, mostly for i18n
            // purposes.
            lst.Add(new TestDescriptor("basic-syntax25", "{{ \"fred\" }}", ContextObjects.empty, ContextObjects.p("fred")));
            lst.Add(new TestDescriptor("basic-syntax25-sq1", "{{ '\"fred\"' }}", ContextObjects.empty, ContextObjects.p("\"fred\"")));
            // No unescape for double-quote inside a single quoted string
            lst.Add(new TestDescriptor("basic-syntax25-sq2", "{{ 'fr\"ed' }}", ContextObjects.empty, ContextObjects.p("fr\"ed")));
            lst.Add(new TestDescriptor("basic-syntax26", "{% autoescape off %}{{ \"\\\"fred\\\"\" }}{% endautoescape %}", ContextObjects.empty, ContextObjects.p("\"fred\"")));
            lst.Add(new TestDescriptor("basic-syntax27", "{{ _(\"\\\"fred\\\"\") }}", ContextObjects.empty, ContextObjects.p("\"fred\"")));

            // List-index syntax allows a template to access a certain item of a subscriptable object.
            lst.Add(new TestDescriptor("list-index01", "{{ var.1 }}", ContextObjects.p("var", ContextObjects.list("first item", "second item")), ContextObjects.p("second item")));

            // Fail silently when the list index is out of range.
            lst.Add(new TestDescriptor("list-index02", "{{ var.5 }}", ContextObjects.p("var", ContextObjects.list("first item", "second item")), ContextObjects.p("", "INVALID")));

            // Fail silently when the variable is not a subscriptable object.
            lst.Add(new TestDescriptor("list-index03", "{{ var.1 }}", ContextObjects.p("var", new ContextObjects.SomeClass()), ContextObjects.p("", "INVALID")));

            // Fail silently when variable is a dict without the specified key.
            lst.Add(new TestDescriptor("list-index04", "{{ var.1 }}", ContextObjects.p("var", ContextObjects.dict()), ContextObjects.p("", "INVALID")));

            // Dictionary lookup wins out when dict's key is a string.
            lst.Add(new TestDescriptor("list-index05", "{{ var.1 }}", ContextObjects.p("var", ContextObjects.dict("1", "hello")), ContextObjects.p("hello")));

            // But list-index lookup wins out when dict's key is an int, which
            // behind the scenes is really a dictionary lookup (for a dict)
            // after converting the key to an int.
            lst.Add(new TestDescriptor("list-index06", "{{ var.1 }}", ContextObjects.p("var", ContextObjects.dict(1, "hello")), ContextObjects.p("hello")));

            // Dictionary lookup wins out when there is a string and int version of the key.
            lst.Add(new TestDescriptor("list-index07", "{{ var.1 }}", ContextObjects.p("var", ContextObjects.dict("1", "hello", 1, "world")), ContextObjects.p("hello")));

            return(lst);
        }
Ejemplo n.º 5
0
        public IList <TestDescriptor> GetMiscellaneousTagsTests()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();

            // autoescape tag
            lst.Add(new TestDescriptor("autoescape-tag", "before <{{ lt }} {% autoescape off %}inside <{{ lt }}{{ gt }}>{% endautoescape %} after {{ gt }}>", ContextObjects.p("lt", "<", "gt", ">"), ContextObjects.p("before <&lt; inside <<>> after &gt;>")));

            // ### COMMENT TAG ################################################################
            lst.Add(new TestDescriptor("comment-tag", "before {% comment %}hide this: {% invalid tag %} {% endcomment %} after", ContextObjects.empty, ContextObjects.p("before  after")));

            // DEBUG TAG
            lst.Add(new TestDescriptor("debug", "{% debug %}", ContextObjects.p("v2", null, "v3", "vee3"),
                                       ContextObjects.p("System.Collections.Generic.Dictionary`2[System.String,System.Object]\r\n---- NDjango Context ----\r\nSettings:\r\nautoescape = True\r\nVariables:\r\nv2 = NULL\r\nv3 = \"vee3\"\r\n")));

            // FIRSTOF TAG
            lst.Add(new TestDescriptor("firstof01", "{% firstof v1 v2 v3 \"fallback\" %}", ContextObjects.empty, ContextObjects.p("fallback")));
            lst.Add(new TestDescriptor("firstof02", "{% firstof v1 v2 v3 \"fallback\" %}", ContextObjects.p("v2", "vee2", "v3", "vee3"), ContextObjects.p("vee2")));
            lst.Add(new TestDescriptor("firstof03", "{% firstof v1 v2 v3 \"fallback\" %}", ContextObjects.p("v2", null, "v3", "vee3"), ContextObjects.p("vee3")));

            // NOW TAG
            lst.Add(new TestDescriptor("now 01", "{% now \"D,d F Y G:i:s O\" %}", ContextObjects.empty, () => new object[] { DateTime.Now.ToString("ddd,dd MMMM yyyy %H:mm:ss zzz") }));
            lst.Add(new TestDescriptor("now 02", "{% now \"D,d F Y G:i:\\s O\" %}", ContextObjects.empty, () => new object[] { DateTime.Now.ToString("ddd,dd MMMM yyyy %H:mm:\\s zzz") }));

            lst.Add(new TestDescriptor("date filter 01", "{{ now|date:\"D,d F Y G:i:s O\" }}", ContextObjects.p("now", DateTime.Now), ContextObjects.p(DateTime.Now.ToString("ddd,dd MMMM yyyy %H:mm:ss zzz"))));
            lst.Add(new TestDescriptor("date filter 02", "{{ now|date:\"D,d F Y G:i:\\s O\" }}", ContextObjects.p("now", DateTime.Now), ContextObjects.p(DateTime.Now.ToString("ddd,dd MMMM yyyy %H:mm:\\s zzz"))));
            lst.Add(new TestDescriptor("date filter 03", "{{ now|date:\"D,d F Y G:i:\\s O\" }}", ContextObjects.p("now", null), ContextObjects.p(DateTime.MinValue.ToString("ddd,dd MMMM yyyy %H:mm:\\s zzz"))));

            // BLOCK TAG
            lst.Add(new TestDescriptor("block 01", "some html out{% block something %} some html in{% endblock %} more html out", null, ContextObjects.p("some html out some html in more html out")));

            // EXTENDS TAG
            lst.Add(new TestDescriptor("extends 01", "{% extends \"t1\" %} skip1--{% block b1 %}the replacement{% endblock %}--skip2", null, ContextObjects.p("insert1--the replacement--insert2")));
            lst.Add(new TestDescriptor("extends 01-bis", "{% extends 't1' %} skip1--{% block b1 %}the replacement{% endblock %}--skip2", null, ContextObjects.p("insert1--the replacement--insert2")));
            lst.Add(new TestDescriptor("extends 02", "{% extends \"t21\" %} skip1--{% block b1 %}the replacement1{% endblock %}{% block b2 %} the replacement2{% endblock %}--skip2", null, ContextObjects.p("insert1--the replacement1 the replacement2--insert2")));
            lst.Add(new TestDescriptor("extends 03", "{% extends \"t21\" %} skip1--{% block b1 %}the replacement1{% endblock %}--skip2", null, ContextObjects.p("insert1--the replacement1to be replaced22--insert2")));
            lst.Add(new TestDescriptor("extends 04", "{% extends \"t21\" %} skip1--{% block b1 %}the replacement1++{{ block.super }}++{% endblock %}--skip2", null,
                                       ContextObjects.p("insert1--the replacement1++to be replaced21++to be replaced22--insert2")));

            lst.Add(new TestDescriptor("extends 04 - breaking parents", "{% extends \"t21-withif\" %} skip1--{% block b1 %}the replacement1++{{ block.super }}++{% endblock %}--skip2", null,
                                       ContextObjects.p("insert1--the replacement1++to be replaced21++to be replaced22--insert2")));

            lst.Add(new TestDescriptor("extends 05", "{% extends \"t21middle\" %} {% block b2 %} child {% endblock %}", null, ContextObjects.p("text child text")));
//            lst.Add(new TestDescriptor("extends 05", "{% extends \"t21middle\" %} {% block b2 %} child {% endblock %}", null, ContextObjects.p("text child text")));
//            lst.Add(new TestDescriptor("extends 05-nested", "{% extends \"t21top\" %} {% block b3 %} {{block.super.super}} {% endblock %} {% block b4 %} *{{block.super}}* {% endblock %}", null, ContextObjects.p("text child text")));

            // Nested block tags
            lst.Add(new TestDescriptor("nestedblocks 01",
                                       @"{% extends ""tBaseNested"" %}
{% block outer %}
{{ block.super }}
new stuff
{% endblock outer %}", null, ContextObjects.p(@"


this is inner1


this is inner2


new stuff
")));
            lst.Add(new TestDescriptor("nestedblocks 02",
                                       @"{% extends ""tBaseNested"" %}
{% block outer %}
{{ block.super }}
new stuff
{% endblock outer %}
{% block inner2 %}
new inner2
{% endblock inner2 %}", null, ContextObjects.p(@"


this is inner1


new inner2


new stuff
")));
            lst.Add(new TestDescriptor("nestedblocks 03 - \"don't do this!\"",
                                       @"{% extends ""tBaseNested"" %}
{% block outer %}
{{ block.super }}
new stuff
{% block inner2 %}
new inner2
{% endblock inner2 %}
{% endblock outer %}", null, ContextObjects.p(@"


this is inner1


new inner2


new stuff

new inner2

")));


            // filter tag
            lst.Add(new TestDescriptor("filter-tag", "before <{{ lt }} {% autoescape off %}inside <{{ lt }}{{ gt }}>{% filter escape %} inside filter <{{ lt }}{{ gt }}>{% endfilter %}{% endautoescape %} after {{ gt }}>"
                                       , ContextObjects.p("lt", "<", "gt", ">"), ContextObjects.p("before <&lt; inside <<>> inside filter &lt;&lt;&gt;&gt; after &gt;>")));

            // include tag
            lst.Add(new TestDescriptor("include 01", "value={{ value }} {% include \"include-name\" %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("value=VALUE inside included template VALUE")));

            ContextObjects.Person[] people = new ContextObjects.Person[] {
                new ContextObjects.Person("George", "Bush", "Male"),
                new ContextObjects.Person("Bill", "Clinton", "Male"),
                new ContextObjects.Person("Margaret", "Thatcher", "Female"),
                new ContextObjects.Person("Condoleezza", "Rice", "Female"),
                new ContextObjects.Person("Pat", "Smith", "Unknown")
            };

            // regroup tag
            lst.Add(new TestDescriptor("regroup-01",
                                       @"{% regroup people by gender as gender_list %}<ul>
{% for gender in gender_list %}
    <li>{{ gender.grouper }}
    <ul>
        {% for item in gender.list %}
        <li>{{ item.first_name }} {{ item.last_name }}</li>
        {% endfor %}
    </ul>
    </li>
{% endfor %}
</ul>",
                                       ContextObjects.p("people", people),
                                       ContextObjects.p(
                                           @"<ul>

    <li>Male
    <ul>
        
        <li>George Bush</li>
        
        <li>Bill Clinton</li>
        
    </ul>
    </li>

    <li>Female
    <ul>
        
        <li>Margaret Thatcher</li>
        
        <li>Condoleezza Rice</li>
        
    </ul>
    </li>

    <li>Unknown
    <ul>
        
        <li>Pat Smith</li>
        
    </ul>
    </li>

</ul>"
                                           )));

            // spaceless tag
            lst.Add(new TestDescriptor("spaceless-01", "{% spaceless %}templatetag<h1>  \r\n   </h1> !\r\n <h2> </h2>{% endspaceless %}", ContextObjects.empty, ContextObjects.p("templatetag<h1></h1> !\r\n <h2></h2>")));

            // ssi tag
            lst.Add(new TestDescriptor("ssi 01", "value={{ value }} {% ssi include-name parsed %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("value=VALUE inside included template VALUE")));
            lst.Add(new TestDescriptor("ssi 02", "value={{ value }} {% ssi include-name %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("value=VALUE inside included template {{ value }}")));

            // tho following 3 tests are intended to test the buffer boundary - set the buffer length
            // in the ssi tag implementation to 14 for them to make sense
            lst.Add(new TestDescriptor("ssi 03", "{% ssi buffer-length %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("buffer-length")));
            lst.Add(new TestDescriptor("ssi 04", "{% ssi buffer-length1 %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("buffer-length1")));
            lst.Add(new TestDescriptor("ssi 05", "{% ssi buffer-length11 %}", ContextObjects.p("value", "VALUE"), ContextObjects.p("buffer-length11")));

            // template tag
            lst.Add(new TestDescriptor("templatetag-01", "{% templatetag openblock %} templatetag openblock {% templatetag closeblock %}", ContextObjects.empty, ContextObjects.p("{% templatetag openblock %}")));

            // WidthRatio tag
            lst.Add(new TestDescriptor("widthratio-01", "{% widthratio value maxValue 100 %}", ContextObjects.p("value", 175, "maxValue", "200"), ContextObjects.p("88")));

            // With tag
            lst.Add(new TestDescriptor("with-01", "{% with var.otherclass.method as newvar %}{{ newvar }}{% endwith %} {{ newvar }}", ContextObjects.p("var", new ContextObjects.SomeClass(), "newvar", "newvar"), ContextObjects.p("OtherClass.method newvar")));

            // URL tag
            lst.Add(new TestDescriptor("url-01", "{% url \"hello/{0}\" parm1 %}", ContextObjects.p("parm1", "world"), ContextObjects.p("/appRoot/hello/world")));
            lst.Add(new TestDescriptor("url-02", "{% url \"hello/{0}/{1}\" parm1, parm2%}", ContextObjects.p("parm1", "new", "parm2", "world"), ContextObjects.p("/appRoot/hello/new/world")));
            lst.Add(new TestDescriptor("url-03", "no {% url \"hello/{0}/{1}\" parm1, parm2 as foo %}url, then {{ foo }}", ContextObjects.p("parm1", "new", "parm2", "world"), ContextObjects.p("no url, then /appRoot/hello/new/world")));

            // nested simple tag implementation
            lst.Add(new TestDescriptor("simple-nested-tag-01", "{% nested p1 %}{% spaceless %}templatetag<h1>  \r\n   </h1> !\r\n <h2> </h2>{% endspaceless %}{% endnested %}", ContextObjects.p("p1", "parm1"), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("simple-nested-tag-02", "{% nested p1 \"p2\" %}{% spaceless %}templatetag<h1>  \r\n   </h1> !\r\n <h2> </h2>{% endspaceless %}{% endnested %}woo", ContextObjects.p("p1", "parm1"), ContextObjects.p("parm1p2starttemplatetag<h1></h1> !\r\n <h2></h2>endwoo")));

            // non-nested simple tag implementation
            lst.Add(new TestDescriptor("simple-non-nested-tag-01", "{% non-nested p1 \"p2\" %}woo", ContextObjects.p("p1", "parm1"), ContextObjects.p("parm1p2woo")));


            return(lst);
        }
Ejemplo n.º 6
0
        public IList <TestDescriptor> GetIfTagTests()
        {
            IList <TestDescriptor> lst = new List <TestDescriptor>();

            // ### IF TAG ################################################################
            lst.Add(new TestDescriptor("if-tag01", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag02", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag02-1", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p("foo", null), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag03", "{% if foo %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));

            // AND
            lst.Add(new TestDescriptor("if-tag-and01", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-and02", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and03", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and04", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and05", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and06", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and07", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-and08", "{% if foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", true), ContextObjects.p("no")));

            // OR
            lst.Add(new TestDescriptor("if-tag-or01", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or02", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or03", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or04", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or05", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or06", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-or07", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-or08", "{% if foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("bar", true), ContextObjects.p("yes")));

            // TODO, multiple ORs

            // NOT
            lst.Add(new TestDescriptor("if-tag-not01", "{% if not foo %}no{% else %}yes{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not02", "{% if not %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not03", "{% if not %}yes{% else %}no{% endif %}", ContextObjects.p("not", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not04", "{% if not not %}no{% else %}yes{% endif %}", ContextObjects.p("not", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not05", "{% if not not %}no{% else %}yes{% endif %}", ContextObjects.p(), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not06", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not07", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not08", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not09", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not10", "{% if foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not11", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not12", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not13", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not14", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not15", "{% if not foo and bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("no")));

            lst.Add(new TestDescriptor("if-tag-not16", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not17", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not18", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not19", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not20", "{% if foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not21", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not22", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not23", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not24", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not25", "{% if not foo or bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not26", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not27", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not28", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not29", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not30", "{% if not foo and not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            lst.Add(new TestDescriptor("if-tag-not31", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p(), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not32", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("if-tag-not33", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not34", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("if-tag-not35", "{% if not foo or not bar %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p("yes")));

            // AND and OR raises a TemplateSyntaxError
            lst.Add(new TestDescriptor("if-tag-error01", "{% if foo or bar and baz %}yes{% else %}no{% endif %}", ContextObjects.p("foo", false, "bar", false), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error02", "{% if foo and %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error03", "{% if foo or %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error04", "{% if not foo and %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error05", "{% if not foo or %}yes{% else %}no{% endif %}", ContextObjects.p("foo", true), ContextObjects.p(typeof(SyntaxException))));
            lst.Add(new TestDescriptor("if-tag-error06", "{% if not foo %}yes{% else %}no", ContextObjects.p("foo", true), ContextObjects.p(typeof(SyntaxException))));

            // IFEqual TAG
            lst.Add(new TestDescriptor("ifequal-tag-01", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-02", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("ifequal-tag-03", "{% ifnotequal foo bar %}yes{% else %}no{% endifnotequal %}", ContextObjects.p("foo", true, "bar", true), ContextObjects.p("no")));
            lst.Add(new TestDescriptor("ifequal-tag-04", "{% ifnotequal foo bar %}yes{% else %}no{% endifnotequal %}", ContextObjects.p("foo", true, "bar", false), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-05", "{% ifequal foo \"true\" %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", "true"), ContextObjects.p("yes")));
            lst.Add(new TestDescriptor("ifequal-tag-06", "{% ifequal foo bar %}yes{% else %}no{% endifequal %}", ContextObjects.p("foo", "true", "bar", false), ContextObjects.p("no")));

            return(lst);
        }