Permalink
Browse files

Adding tests for the variable lookup using an arity-1 func in the con…

…text.
  • Loading branch information...
1 parent beed843 commit fb6a0a9fcf0dd7c64cb6b0d1df32f5405a376a7c @noss noss committed Dec 17, 2009
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/tests/erlydtl_unittests.erl
@@ -59,10 +59,14 @@ tests() ->
<<"{{ var1 }}">>, dict:store(var1, "bar", dict:new()), <<"bar">>},
{"Render variable in gb_tree",
<<"{{ var1 }}">>, gb_trees:insert(var1, "bar", gb_trees:empty()), <<"bar">>},
+ {"Render variable in arity-1 func",
+ <<"I enjoy {{ var1 }}">>, fun (var1) -> "Othello" end, <<"I enjoy Othello">>},
{"Render variable with attribute in dict",
<<"{{ var1.attr }}">>, [{var1, dict:store(attr, "Othello", dict:new())}], <<"Othello">>},
{"Render variable with attribute in gb_tree",
<<"{{ var1.attr }}">>, [{var1, gb_trees:insert(attr, "Othello", gb_trees:empty())}], <<"Othello">>},
+ {"Render variable with attribute in arity-1 func",
+ <<"I enjoy {{ var1.game }}">>, [{var1, fun (game) -> "Othello" end}], <<"I enjoy Othello">>},
{"Render variable in parameterized module",
<<"{{ var1.some_var }}">>, [{var1, erlydtl_example_variable_storage:new("foo")}], <<"foo">>},
{"Nested attributes",

0 comments on commit fb6a0a9

Please sign in to comment.