Permalink
Browse files

Add unit tests for {% elif Expr %} syntax

  • Loading branch information...
1 parent 914781a commit 748dc8b958e3bc4a2df7821a25710f187ff5548a @psyeugenic psyeugenic committed with psyeugenic Jul 19, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 tests/src/erlydtl_unittests.erl
@@ -87,6 +87,13 @@ tests() ->
{"if", [
{"If/else",
<<"{% if var1 %}boo{% else %}yay{% endif %}">>, [{var1, ""}], <<"yay">>},
+ {"If elif",
+ <<"{% if var1 %}boo{% elif var2 %}yay{% endif %}">>, [{var1, ""}, {var2, "happy"}], <<"yay">>},
+ {"If elif/else",
+ <<"{% if var1 %}boo{% elif var2 %}sad{% else %}yay{% endif %}">>, [{var1, ""}, {var2, ""}], <<"yay">>},
+ {"If elif/elif/else",
+ <<"{% if var1 %}boo{% elif var2 %}yay{% elif var3 %}sad{% else %}noo{% endif %}">>, [{var1, ""},
+ {var2, "happy"}, {var3, "not_taken"}], <<"yay">>},
{"If",
<<"{% if var1 %}boo{% endif %}">>, [{var1, ""}], <<>>},
{"If not",

0 comments on commit 748dc8b

Please sign in to comment.