Browse Source

Merge pull request #76 from davidw/with_problem

Added a few tests of with with variables/attributes.
Evan Miller 12 years ago
parent
commit
db926edd1b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      tests/src/erlydtl_unittests.erl

+ 4 - 0
tests/src/erlydtl_unittests.erl

@@ -1085,6 +1085,10 @@ tests() ->
                 <<"{% with a=1 %}{{ a }}{% endwith %}">>, [], <<"1">>},
             {"Cache variable",
                 <<"{% with a=b %}{{ a }}{% endwith %}">>, [{b, "foo"}], <<"foo">>},
+	      {"Cache variable with attribute",
+                    <<"I enjoy {% with a = var1 %}{{ a.game }}{% endwith %}">>, [{var1, [{game, "Othello"}]}], <<"I enjoy Othello">>},
+	      {"Cache variable attribute",
+                    <<"I enjoy {% with a = var1.game %}{{ a }}{% endwith %}">>, [{var1, [{game, "Othello"}]}], <<"I enjoy Othello">>},
             {"Cache multiple",
                 <<"{% with alpha=1 beta=b %}{{ alpha }}/{{ beta }}{% endwith %}">>, [{b, 2}], <<"1/2">>}
         ]},