Просмотр исходного кода

Tests demonstrating failure of a custom tag with single string argument.

David N. Welton 12 лет назад
Родитель
Сommit
7ffe32206e

+ 1 - 0
tests/input/custom_tag4

@@ -0,0 +1 @@
+{% custom4 "a" %}

+ 4 - 1
tests/src/erlydtl_custom_tags.erl

@@ -1,6 +1,6 @@
 -module(erlydtl_custom_tags).
 
--export([custom1/1, custom2/2, custom3/2]).
+-export([custom1/1, custom2/2, custom3/2, custom4/1]).
 
 custom1(_TagVars = []) ->
     <<"b1">>.
@@ -11,3 +11,6 @@ custom2([], _RenderOptions = [{locale, ru}, {foo, bar}]) ->
 custom3([], _RenderOptions = [{locale, ru}]) ->
     <<"b3">>.
 
+custom4(TagVars) ->
+    Lst = [binary_to_list(X) || X <- TagVars],
+    string:join(Lst, "|").

+ 3 - 1
tests/src/erlydtl_functional_tests.erl

@@ -45,7 +45,7 @@ test_list() ->
         "for_records_preset", "include", "if", "if_preset", "ifequal",
         "ifequal_preset", "ifnotequal", "ifnotequal_preset", "now",
         "var", "var_preset", "cycle",
-        "custom_tag", "custom_tag1", "custom_tag2", "custom_tag3",
+        "custom_tag", "custom_tag1", "custom_tag2", "custom_tag3", "custom_tag4",
         "custom_call", 
         "include_template", "include_path", "ssi",
         "extends_path", "extends_path2", "trans", "extends2", "extends3" ].
@@ -172,6 +172,8 @@ setup("custom_tag2") ->
     {ok, [{a, <<"a1">>}], [{locale, ru}, {foo, bar}], <<"b2\n">>};
 setup("custom_tag3") ->
     {ok, [{a, <<"a1">>}], [{locale, ru}], <<"b3\n">>};
+setup("custom_tag4") ->
+    {ok, [<<"a|b">>, <<"\n">>]};
 setup("ssi") ->
     RenderVars = [{path, filename:absname(filename:join(["tests", "input", "ssi_include.html"]))}],
     {ok, RenderVars};