1. Benoit Chesneau
  2. erlydtl

Commits

rsa...@a5195066-8e3e-0410-a82a-05b01b1b9875  committed 7ada345

example templates bugfix: call custom tag cannot not call a module which name is a erlydtl tagname, now all examples are building again

  • Participants
  • Parent commits 6ee212b
  • Branches default

Comments (0)

Files changed (2)

File examples/docroot/custom_call

View file
->>>> before custom call tag 'test_comment'
-{% call test_comment %}
->>>> after custom call tag 'test_comment'
+>>>> before custom call tag 'comment'
+{% call example_for_preset %}
+>>>> after custom call tag 'comment'
 
->>>> before custom call tag 'test_if'
-{% call test_if with var1 %}
->>>> after custom call tag 'test_if'
+>>>> before custom call tag 'if'
+{% call example_if with var1 %}
+>>>> after custom call tag 'if'

File src/tests/erlydtl_functional_tests.erl

View file
 setup("custom_tag_error") ->
     CompileVars  = [],
     RenderVars = [],
-    {error, CompileVars, ignore, RenderVars};        
+    {error, CompileVars, skip, RenderVars};        
 setup("custom_call") ->
     CompileVars  = [],
     RenderVars = [{var1, "something"}],
                 {N, []}->
                     Msg = lists:concat(["All ", N, " functional tests passed"]),
                     {ok, Msg};
-                {_, Errs} -> 
-                    {error, Errs}
+                {_, Errs} ->
+                    io:format("Errors: ~p~n",[Errs]),
+                    failed
             end;
         Err ->
             Err
         end, {0, []}). 
 
 
-test_compile_render(File) ->   
-    Module = filename:rootname(filename:basename(File)),
-    case setup(Module) of
+test_compile_render(File) ->  
+    Name = filename:rootname(filename:basename(File)),
+    Module = "example_" ++ Name,
+    case setup(Name) of
         {CompileStatus, CompileVars, RenderStatus, RenderVars} ->
             Options = [
                 {vars, CompileVars}, 
                 {force_recompile, true}],
-            io:format("Template: ~p, ... compiling ... ", [Module]),
+            io:format("Template: ~p, ... compiling ... ", [Name]),
             case erlydtl_compiler:compile(File, Module, Options) of
                 ok ->
                     case CompileStatus of
                         ok -> test_render(File, list_to_atom(Module), RenderStatus, RenderVars);
                         _ -> {error, "compiling should have failed :" ++ File}
                     end;
-                Err ->
+                {error, Err} ->
                     case CompileStatus of
-                        error ->  ok;
-                        _ -> Err
+                        error ->
+                            io:format("~n"),  
+                            ok;
+                        _ ->
+                            io:format("~nCompile errror: ~p~n",[Err]), 
+                            Err
                     end
             end;
         skip ->