Browse Source

fixed the functional tests and renamed the folder to "exampes"

git-svn-id: http://erlydtl.googlecode.com/svn/trunk@122 a5195066-8e3e-0410-a82a-05b01b1b9875
rsaccon 17 years ago
parent
commit
c6d174ec4c
98 changed files with 124 additions and 1253 deletions
  1. 0 8
      demo/out/test_autoescape.html
  2. 0 15
      demo/out/test_comment.html
  3. 0 26
      demo/out/test_custom_call.html
  4. 0 33
      demo/out/test_custom_tag.html
  5. 0 11
      demo/out/test_extends.html
  6. 0 42
      demo/out/test_filters.html
  7. 0 13
      demo/out/test_for.html
  8. 0 7
      demo/out/test_for_list.html
  9. 0 7
      demo/out/test_for_list_preset.html
  10. 0 13
      demo/out/test_for_preset.html
  11. 0 13
      demo/out/test_for_records.html
  12. 0 23
      demo/out/test_for_records_preset.html
  13. 0 7
      demo/out/test_for_tuple.html
  14. 0 4
      demo/out/test_if.html
  15. 0 4
      demo/out/test_if_preset.html
  16. 0 28
      demo/out/test_ifequal.html
  17. 0 28
      demo/out/test_ifequal_preset.html
  18. 0 28
      demo/out/test_ifnotequal.html
  19. 0 28
      demo/out/test_ifnotequal_preset.html
  20. 0 2
      demo/out/test_include.html
  21. 0 5
      demo/out/test_var.html
  22. 0 9
      demo/out/test_var_preset.html
  23. 0 11
      demo/templates/base.html
  24. 0 3
      demo/templates/test_extends.html
  25. 0 0
      examples/docroot/autoescape
  26. 0 0
      examples/docroot/base
  27. 0 0
      examples/docroot/comment
  28. 0 0
      examples/docroot/custom_call
  29. 0 0
      examples/docroot/custom_tag
  30. 0 0
      examples/docroot/custom_tag_error
  31. 0 0
      examples/docroot/extends
  32. 0 0
      examples/docroot/filters
  33. 0 0
      examples/docroot/for
  34. 0 0
      examples/docroot/for_list
  35. 0 0
      examples/docroot/for_list_preset
  36. 0 0
      examples/docroot/for_preset
  37. 0 0
      examples/docroot/for_records
  38. 0 0
      examples/docroot/for_records_preset
  39. 0 0
      examples/docroot/for_tuple
  40. 0 0
      examples/docroot/if
  41. 0 0
      examples/docroot/if_preset
  42. 0 0
      examples/docroot/ifequal
  43. 0 0
      examples/docroot/ifequal_preset
  44. 0 0
      examples/docroot/ifnotequal
  45. 0 0
      examples/docroot/ifnotequal_preset
  46. 0 0
      examples/docroot/include
  47. 0 0
      examples/docroot/include.html
  48. 0 0
      examples/docroot/var
  49. 0 0
      examples/docroot/var_error
  50. 0 0
      examples/docroot/var_preset
  51. 124 14
      src/tests/erlydtl_functional_tests.erl
  52. 0 166
      src/tests/erlydtl_testsuite.erl
  53. 0 8
      tests/out/test_autoescape
  54. 0 15
      tests/out/test_comment
  55. 0 26
      tests/out/test_custom_call
  56. 0 33
      tests/out/test_custom_tag
  57. 0 11
      tests/out/test_extends
  58. 0 42
      tests/out/test_filters
  59. 0 13
      tests/out/test_for
  60. 0 7
      tests/out/test_for_list
  61. 0 7
      tests/out/test_for_list_preset
  62. 0 13
      tests/out/test_for_preset
  63. 0 13
      tests/out/test_for_records
  64. 0 23
      tests/out/test_for_records_preset
  65. 0 7
      tests/out/test_for_tuple
  66. 0 4
      tests/out/test_if
  67. 0 4
      tests/out/test_if_preset
  68. 0 28
      tests/out/test_ifequal
  69. 0 28
      tests/out/test_ifequal_preset
  70. 0 28
      tests/out/test_ifnotequal
  71. 0 28
      tests/out/test_ifnotequal_preset
  72. 0 2
      tests/out/test_include
  73. 0 5
      tests/out/test_var
  74. 0 9
      tests/out/test_var_preset
  75. 0 1
      tests/templates/include
  76. 0 8
      tests/templates/test_autoescape
  77. 0 17
      tests/templates/test_comment
  78. 0 7
      tests/templates/test_custom_call
  79. 0 13
      tests/templates/test_custom_tag
  80. 0 12
      tests/templates/test_custom_tag_error
  81. 0 42
      tests/templates/test_filters
  82. 0 9
      tests/templates/test_for
  83. 0 3
      tests/templates/test_for_list
  84. 0 3
      tests/templates/test_for_list_preset
  85. 0 9
      tests/templates/test_for_preset
  86. 0 9
      tests/templates/test_for_records
  87. 0 15
      tests/templates/test_for_records_preset
  88. 0 3
      tests/templates/test_for_tuple
  89. 0 4
      tests/templates/test_if
  90. 0 4
      tests/templates/test_if_preset
  91. 0 43
      tests/templates/test_ifequal
  92. 0 43
      tests/templates/test_ifequal_preset
  93. 0 43
      tests/templates/test_ifnotequal
  94. 0 43
      tests/templates/test_ifnotequal_preset
  95. 0 1
      tests/templates/test_include
  96. 0 5
      tests/templates/test_var
  97. 0 5
      tests/templates/test_var_error
  98. 0 9
      tests/templates/test_var_preset

+ 0 - 8
demo/out/test_autoescape.html

@@ -1,8 +0,0 @@
-
-    This is escaped: <b>bold</b>
-    
-    This is not escaped: <b>bold</b>
-
-    This is escaped: &lt;b&gt;bold&lt;/b&gt;
-    
-

+ 0 - 15
demo/out/test_comment.html

@@ -1,15 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test Comment</title>								 
-  </head>
-  <body>
-	
-	bla
-	
-        blue
-        
-        black
-  </body>
-</html>

+ 0 - 26
demo/out/test_custom_call.html

@@ -1,26 +0,0 @@
->>>> before custom call tag 'test_comment'
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test Comment</title>								 
-  </head>
-  <body>
-	
-	bla
-	
-        blue
-        
-        black
-  </body>
-</html>
-
->>>> after custom call tag 'test_comment'
-
->>>> before custom call tag 'test_if'
-One but not two:  two 
-Two but not one:  one 
-One: 
-None: 
-
->>>> after custom call tag 'test_if'

+ 0 - 33
demo/out/test_custom_tag.html

@@ -1,33 +0,0 @@
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test variable</title>								 
-  </head>
-  <body>
-	before
-	<object id="myvideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600">
-	<param name="movie" value="/static/mediaplayer.swf">
-    <param name="allowfullscreen" value="true">
-    <param name="menu" value="false">
-    <param name="flashvars" value="file=/myvid.mp4&image=/mypic.jpg">
-    <!--[if !IE]>-->
-    <object type="application/x-shockwave-flash" data="/static/mediaplayer.swf" width="800" height="620">
-    <param name="allowfullscreen" value="true">
-    <param name="menu" value="false">
-    <param name="flashvars" value="file=/myvid.mp4&image=/mypic.jpg">
-    <!--<![endif]-->
-    <h2>To view the Video:</h2>
-    <p>
-    	<a href="http://www.adobe.com/go/getflashplayer">
-        	<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"alt="Get Adobe Flash player">
-    	</a>
-    </p>
-    <!--[if !IE]>-->
-    </object>
-    <!--<![endif]-->
-</object>
-	after
-  </body>
-</html>

+ 0 - 11
demo/out/test_extends.html

@@ -1,11 +0,0 @@
-base-barstring
-
-base template
-
-replacing the base title
-
-more of base template
-
-replacing the base content - variable: test-barstring after variable 
-
-end of base template

+ 0 - 42
demo/out/test_filters.html

@@ -1,42 +0,0 @@
-Capfirst: Capitalized
-
-Centered:
-<pre>
-       center       
-</pre>
-
-Escape JS: \" \'
-
-First letter: f
-
-Fix ampersands: &amp;
-
-Force_escape: &lt;b&gt;&lt;/b&gt;
-
-Joined: eins, zwei, drei
-
-Last: t
-
-Length: 3
-
-Length is 2?: false
-
-Left adjust: 
-<pre>
-left                
-</pre>
-
-Line breaks: Line 1<br />Line 2<br />Line 3
-
-Lowercase: lowercase
-
-Plus: 2 + 2 = 4
-
-Right adjust:
-<pre>
-               right
-</pre>
-
-Uppercase: UPPERCASE
-
-URL Encode: Let%27s+go%21

+ 0 - 13
demo/out/test_for.html

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-<li>1. apple</li>
-
-<li>2. banana</li>
-
-<li>3. coconut</li>
-
-</ul>
-
-after

+ 0 - 7
demo/out/test_for_list.html

@@ -1,7 +0,0 @@
-
-More than one apple is called "apples". Only $1 each!
-
-More than one banana is called "bananas". Only $2 each!
-
-More than one coconut is called "coconuts". Only $500 each!
-

+ 0 - 7
demo/out/test_for_list_preset.html

@@ -1,7 +0,0 @@
-
-More than one apple is called "apples".
-
-More than one banana is called "bananas".
-
-More than one coconut is called "coconuts".
-

+ 0 - 13
demo/out/test_for_preset.html

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-	<li>preset-apple</li>
-
-	<li>preset-banana</li>
-
-	<li>preset-coconut</li>
-
-</ul>
-
-after

+ 0 - 13
demo/out/test_for_records.html

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-	<li><a href="http://amazon.com">Amazon</a></li>
-
-	<li><a href="http://google.com">Google</a></li>
-
-	<li><a href="http://microsoft.com">Microsoft</a></li>
-
-</ul>
-
-after

+ 0 - 23
demo/out/test_for_records_preset.html

@@ -1,23 +0,0 @@
-before
-
-<ul>
-
-	<li><a href="http://canon.com">Canon</a></li>
-
-	<li><a href="http://leica.com">Leica</a></li>
-
-	<li><a href="http://nikon.com">Nikon</a></li>
-
-</ul>
-
-<ul>
-
-	<li><a href="http://amazon.com">Amazon (preset)</a></li>
-
-	<li><a href="http://google.com">Google (preset)</a></li>
-
-	<li><a href="http://microsoft.com">Microsoft (preset)</a></li>
-
-</ul>
-
-after

+ 0 - 7
demo/out/test_for_tuple.html

@@ -1,7 +0,0 @@
-
-One apple, two apples!
-
-One banana, two bananas!
-
-One coconut, two coconuts!
-

+ 0 - 4
demo/out/test_if.html

@@ -1,4 +0,0 @@
-One but not two:  one 
-Two but not one:  two 
-One:  one 
-None: 

+ 0 - 4
demo/out/test_if_preset.html

@@ -1,4 +0,0 @@
-One but not two:  one 
-Two but not one:  two 
-One:  one 
-None: 

+ 0 - 28
demo/out/test_ifequal.html

@@ -1,28 +0,0 @@
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-
-
-else: var1="foo" and var3="bar" are not equal
-
-
-
-if: "foo" and "foo" are equal
-
-
-
-else: "foo" and "bar" are not equal
-
-
-
-if: 99 and 99 are equal
-
-
-
-else: 77 and 99 are not equal

+ 0 - 28
demo/out/test_ifequal_preset.html

@@ -1,28 +0,0 @@
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-
-
-else: var1="foo" and var3="bar" are not equal
-
-
-
-if: "foo" and "foo" are equal
-
-
-
-else: "foo" and "bar" are not equal
-
-
-
-if: 99 and 99 are equal
-
-
-
-else: 77 and 99 are not equal

+ 0 - 28
demo/out/test_ifnotequal.html

@@ -1,28 +0,0 @@
-
-
-
-else: var1="foo" and var2="foo" are not equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-else: "foo" and "foo" are not equal
-
-
-
-if: "foo" and "bar" are equal
-
-
-
-else: 99 and 99 are not equal
-
-
-
-if: 77 and 99 are equal

+ 0 - 28
demo/out/test_ifnotequal_preset.html

@@ -1,28 +0,0 @@
-
-
-
-else: var1="foo" and var2="foo" are not equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-else: "foo" and "foo" are not equal
-
-
-
-if: "foo" and "bar" are equal
-
-
-
-else: 99 and 99 are not equal
-
-
-
-if: 77 and 99 are equal

+ 0 - 2
demo/out/test_include.html

@@ -1,2 +0,0 @@
-Including another file: This is included! foostring1
-

+ 0 - 5
demo/out/test_var.html

@@ -1,5 +0,0 @@
-before varriable1
-foostring1
-after variable1
-foostring2
-after variable2 (HTML-comment-wrapped)

+ 0 - 9
demo/out/test_var_preset.html

@@ -1,9 +0,0 @@
-one
-foostring1
-two
-preset-var1
-three
-foostring2
-four
-preset-var2
-five

+ 0 - 11
demo/templates/base.html

@@ -1,11 +0,0 @@
-{{ base_var }}
-
-base template
-
-{% block title %}base title{% endblock %}
-
-more of base template
-
-{% block content %}base content{% endblock %}
-
-end of base template

+ 0 - 3
demo/templates/test_extends.html

@@ -1,3 +0,0 @@
-{% extends "base.html" %}
-{% block title %}replacing the base title{% endblock %}
-{% block content %}replacing the base content - variable: {{ test_var }} after variable {% endblock %}

+ 0 - 0
demo/templates/test_autoescape.html → examples/docroot/autoescape


+ 0 - 0
tests/templates/base → examples/docroot/base


+ 0 - 0
demo/templates/test_comment.html → examples/docroot/comment


+ 0 - 0
demo/templates/test_custom_call.html → examples/docroot/custom_call


+ 0 - 0
demo/templates/test_custom_tag.html → examples/docroot/custom_tag


+ 0 - 0
demo/templates/test_custom_tag_error.html → examples/docroot/custom_tag_error


+ 0 - 0
tests/templates/test_extends → examples/docroot/extends


+ 0 - 0
demo/templates/test_filters.html → examples/docroot/filters


+ 0 - 0
demo/templates/test_for.html → examples/docroot/for


+ 0 - 0
demo/templates/test_for_list.html → examples/docroot/for_list


+ 0 - 0
demo/templates/test_for_list_preset.html → examples/docroot/for_list_preset


+ 0 - 0
demo/templates/test_for_preset.html → examples/docroot/for_preset


+ 0 - 0
demo/templates/test_for_records.html → examples/docroot/for_records


+ 0 - 0
demo/templates/test_for_records_preset.html → examples/docroot/for_records_preset


+ 0 - 0
demo/templates/test_for_tuple.html → examples/docroot/for_tuple


+ 0 - 0
demo/templates/test_if.html → examples/docroot/if


+ 0 - 0
demo/templates/test_if_preset.html → examples/docroot/if_preset


+ 0 - 0
demo/templates/test_ifequal.html → examples/docroot/ifequal


+ 0 - 0
demo/templates/test_ifequal_preset.html → examples/docroot/ifequal_preset


+ 0 - 0
demo/templates/test_ifnotequal.html → examples/docroot/ifnotequal


+ 0 - 0
demo/templates/test_ifnotequal_preset.html → examples/docroot/ifnotequal_preset


+ 0 - 0
demo/templates/test_include.html → examples/docroot/include


+ 0 - 0
demo/templates/include.html → examples/docroot/include.html


+ 0 - 0
demo/templates/test_var.html → examples/docroot/var


+ 0 - 0
demo/templates/test_var_error.html → examples/docroot/var_error


+ 0 - 0
demo/templates/test_var_preset.html → examples/docroot/var_preset


+ 124 - 14
src/tests/erlydtl_tests.erl → src/tests/erlydtl_functional_tests.erl

@@ -30,19 +30,16 @@
 %%%
 %%% @since 2008-02-11 by Roberto Saccon
 %%%-------------------------------------------------------------------
--module(erlydtl_tests).
+-module(erlydtl_functional_tests).
 -author('rsaccon@gmail.com').
 -author('emmiller@gmail.com').
 
 
 %% API
--export([setup/1]).
+-export([run_tests/0, run_test/1]).
 
-%%====================================================================
-%% API
-%%====================================================================
-%%--------------------------------------------------------------------
-%% @spec (Name::string()) -> {CompileStatus::atom(), PresetVars::List, RenderStatus::atom(), RenderVars::List}
+%% @spec (Name::string()) -> {CompileStatus::atom(), PresetVars::list(), 
+%%     RenderStatus::atom(), RenderVars::list()} | skip
 %% @doc
 %% @end 
 %%--------------------------------------------------------------------
@@ -138,32 +135,145 @@ setup("var_preset") ->
 setup("var_error") ->
     CompileVars = [],
     RenderVars = [{var1, "foostring1"}],   
-    {ok, CompileVars, error, RenderVars};        
-%% Custom tag
+    {ok, CompileVars, error, RenderVars}; 
+%%--------------------------------------------------------------------       
+%% Custom tags
+%%--------------------------------------------------------------------
 setup("custom_tag") ->
     CompileVars  = [],
     RenderVars = [],
-    {ok, CompileVars, ok, RenderVars};  
-%% Custom tag      
+    {ok, CompileVars, ok, RenderVars};        
 setup("custom_tag_error") ->
     CompileVars  = [],
     RenderVars = [],
-    {error, CompileVars, ignore, RenderVars};
-%% Custom tag        
+    {error, CompileVars, ignore, RenderVars};        
 setup("custom_call") ->
     CompileVars  = [],
     RenderVars = [{var1, "something"}],
-    {ok, CompileVars, ok, RenderVars};        
+    {ok, CompileVars, ok, RenderVars};    
+%%--------------------------------------------------------------------       
+%% Files to ignore:
+%%-------------------------------------------------------------------- 
+setup("base") ->
+    %% example base template used in the extends tag
+    skip; 
+setup("include.html") ->
+    %% example plain text file used in include tag 
+    skip;      
 setup(_) ->
     undefined.
     
 
+run_tests() ->    
+    case maybe_create_parser() of
+        ok ->
+            case fold_tests() of
+                {N, []}->
+                    Msg = lists:concat(["All ", N, " functional tests passed"]),
+                    {ok, Msg};
+                {_, Errs} -> 
+                    {error, Errs}
+            end;
+        Err ->
+            Err
+    end.
+
+
+run_test(Name) ->
+    case maybe_create_parser() of
+        ok ->
+            test_compile_render(filename:join([templates_docroot(), Name]));
+        Err ->
+            Err
+    end.    
+
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
+
+maybe_create_parser() ->
+    case filelib:is_regular(erlydtl:parser_src()) of
+        ok ->
+            ok; 
+        _ ->
+            erlydtl:create_parser()   
+    end.
 
 
+fold_tests() ->
+    filelib:fold_files(templates_docroot(), "^[^\.].+", false,
+        fun
+            (File, {AccCount, AccErrs}) ->
+                case test_compile_render(File) of
+                    ok -> 
+                        {AccCount + 1, AccErrs};
+                    {error, Reason} -> 
+                        {AccCount + 1, [{File, Reason} | AccErrs]}
+                end
+        end, {0, []}). 
 
 
+test_compile_render(File) ->   
+    Module = filename:rootname(filename:basename(File)),
+    case setup(Module) of
+        {CompileStatus, CompileVars, RenderStatus, RenderVars} ->
+            Options = [
+                {vars, CompileVars}, 
+                {force_recompile, true}],
+            io:format("Template: ~p, ... compiling ... ", [Module]),
+            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 ->
+                    case CompileStatus of
+                        error ->  ok;
+                        _ -> Err
+                    end
+            end;
+        skip ->
+            ok;
+        _ ->
+            {error, "no 'setup' clause defined for this test"}
+    end.
 
 
+test_render(File, Module, RenderStatus, Vars) ->   
+    case catch Module:render(Vars) of
+        {ok, Data} ->
+            io:format("rendering~n"), 
+            case RenderStatus of
+                ok ->
+                    {File, _} = Module:source(),
+                    OutFile = filename:join([templates_outdir(), filename:basename(File)]),
+                    case file:open(OutFile, [write]) of
+                        {ok, IoDev} ->
+                            file:write(IoDev, Data),
+                            file:close(IoDev),
+                            ok;    
+                        Err ->
+                            Err
+                    end;
+                _ ->
+                    {error, "rendering should have failed :" ++ File}
+            end;
+        {'EXIT', _} ->
+            io:format("~n"),
+            {error, "failed invoking render method:" ++ Module};
+        Err ->
+            io:format("~n"),
+            case RenderStatus of
+                error ->  ok;
+                _ -> Err
+            end
+    end.   
 
 
+templates_docroot() ->
+    filename:join([erlydtl_deps:get_base_dir(), "examples", "docroot"]).
 
+templates_outdir() ->   
+    filename:join([erlydtl_deps:get_base_dir(), "examples", "rendered_output"]).

+ 0 - 166
src/tests/erlydtl_testsuite.erl

@@ -1,166 +0,0 @@
-%%%-------------------------------------------------------------------
-%%% File:      erlydtl_testsuite.erl
-%%% @author    Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
-%%% @author    Evan Miller <emmiller@gmail.com>
-%%% @copyright 2008 Roberto Saccon, Evan Miller
-%%% @doc       ErlyDTS test suite
-%%% @end
-%%%
-%%% The MIT License
-%%%
-%%% Copyright (c) 2007 Roberto Saccon
-%%%
-%%% Permission is hereby granted, free of charge, to any person obtaining a copy
-%%% of this software and associated documentation files (the "Software"), to deal
-%%% in the Software without restriction, including without limitation the rights
-%%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-%%% copies of the Software, and to permit persons to whom the Software is
-%%% furnished to do so, subject to the following conditions:
-%%%
-%%% The above copyright notice and this permission notice shall be included in
-%%% all copies or substantial portions of the Software.
-%%%
-%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-%%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-%%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-%%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-%%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-%%% THE SOFTWARE.
-%%%
-%%% @since 2007-12-14 by Roberto Saccon
-%%%-------------------------------------------------------------------
--module(erlydtl_testsuite).
--author('rsaccon@gmail.com').
--author('emmiller@gmail.com').
-
-
-
-%% API
--export([run/0, run/1]).
-
-%%====================================================================
-%% API
-%%====================================================================
-%%--------------------------------------------------------------------
-%% @spec 
-%% @doc
-%% @end 
-%%--------------------------------------------------------------------
-
-run() ->    
-    case maybe_create_parser() of
-        ok ->
-            case fold_tests("^test_.*", false) of
-                {N, []}->
-                    Msg = lists:concat(["All ", N, " regression tests passed"]),
-                    {ok, Msg};
-                {_, Errs} -> 
-                    {error, Errs}
-            end;
-        Err ->
-            Err
-    end.
-    
-    
-run(Name) ->
-    case maybe_create_parser() of
-        ok ->
-            case fold_tests("^test_" ++ Name ++ "$", true) of
-                {0, _} -> {error, "Test not found: " ++ Name ++ ".js"};
-                {1, []} -> {ok, "Regression test passed"};
-                {1, Errs} -> {error, Errs};
-                {_, _} -> {error, "Testsuite requires different filename for each test"}
-            end;
-        Err ->
-            Err
-    end.
-    
-    
-%%====================================================================
-%% Internal functions
-%%====================================================================
-
-maybe_create_parser() ->
-    case filelib:is_regular(erlydtl:parser_src()) of
-        ok ->
-            ok; 
-        _ ->
-            erlydtl:create_parser()   
-    end.
-    
-
-fold_tests(RegExp, Verbose) ->
-    filelib:fold_files(templates_docroot(), RegExp, true, 
-        fun
-            (File, {AccCount, AccErrs}) ->
-                case test_compile_render(File, Verbose) of
-                    ok -> 
-                        {AccCount + 1, AccErrs};
-                    {error, Reason} -> 
-                        {AccCount + 1, [{File, Reason} | AccErrs]}
-                end
-        end, {0, []}). 
-        
-
-test_compile_render(File, Verbose) ->   
-    Module = filename:rootname(filename:basename(File)),
-	[$t, $e, $s, $t, $_ | Name] = Module,
-	case catch erlydtl_tests:setup(Name) of
-	    {CompileStatus, CompileVars, RenderStatus, RenderVars} ->
-	        Options = [
-	            {vars, CompileVars}, 
-	            {force_recompile, true},
-	            {verbose, Verbose}],
-            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 ->
-                    case CompileStatus of
-                        error ->  ok;
-                        _ -> Err
-                    end
-            end;
-        _ ->
-            {error, "no test clause for found in erlydtl_test.erl"}
-    end.
- 
- 
-test_render(File, Module, RenderStatus, Vars) ->   
-    case catch Module:render(Vars) of
-        {ok, Data} -> 
-            case RenderStatus of
-                ok ->
-                    {File, _} = Module:source(),
-                    OutFile = filename:join([templates_outdir(), filename:basename(File)]),
-                    case file:open(OutFile, [write]) of
-                        {ok, IoDev} ->
-                            file:write(IoDev, Data),
-                            file:close(IoDev),
-                            ok;    
-                        Err ->
-                            Err
-                    end;
-                _ ->
-                    {error, "rendering should have failed :" ++ File}
-            end;
-        {'EXIT', _} ->
-            {error, "failed invoking render method:" ++ Module};
-        Err ->
-            case RenderStatus of
-                error ->  ok;
-                _ -> Err
-            end
-    end.   
-        
-        
-templates_docroot() ->
-    {file, Ebin} = code:is_loaded(?MODULE),
-    filename:join([filename:dirname(filename:dirname(Ebin)), "tests", "templates"]).
-    
-templates_outdir() ->   
-    {file, Ebin} = code:is_loaded(?MODULE),
-    filename:join([filename:dirname(filename:dirname(Ebin)), "tests", "out"]).

+ 0 - 8
tests/out/test_autoescape

@@ -1,8 +0,0 @@
-
-    This is escaped: &lt;b&gt;bold&lt;/b&gt;
-    
-    This is not escaped: <b>bold</b>
-
-    This is escaped: &lt;b&gt;bold&lt;/b&gt;
-    
-

+ 0 - 15
tests/out/test_comment

@@ -1,15 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test Comment</title>								 
-  </head>
-  <body>
-	
-	bla
-	
-        blue
-        
-        black
-  </body>
-</html>

+ 0 - 26
tests/out/test_custom_call

@@ -1,26 +0,0 @@
->>>> before custom call tag 'test_comment'
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test Comment</title>								 
-  </head>
-  <body>
-	
-	bla
-	
-        blue
-        
-        black
-  </body>
-</html>
-
->>>> after custom call tag 'test_comment'
-
->>>> before custom call tag 'test_if'
-One but not two:  two 
-Two but not one:  one 
-One: 
-None: 
-
->>>> after custom call tag 'test_if'

+ 0 - 33
tests/out/test_custom_tag

@@ -1,33 +0,0 @@
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test variable</title>								 
-  </head>
-  <body>
-	before
-	<object id="myvideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600">
-	<param name="movie" value="/static/mediaplayer.swf">
-    <param name="allowfullscreen" value="true">
-    <param name="menu" value="false">
-    <param name="flashvars" value="file=/myvid.mp4&image=/mypic.jpg">
-    <!--[if !IE]>-->
-    <object type="application/x-shockwave-flash" data="/static/mediaplayer.swf" width="800" height="620">
-    <param name="allowfullscreen" value="true">
-    <param name="menu" value="false">
-    <param name="flashvars" value="file=/myvid.mp4&image=/mypic.jpg">
-    <!--<![endif]-->
-    <h2>To view the Video:</h2>
-    <p>
-    	<a href="http://www.adobe.com/go/getflashplayer">
-        	<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"alt="Get Adobe Flash player">
-    	</a>
-    </p>
-    <!--[if !IE]>-->
-    </object>
-    <!--<![endif]-->
-</object>
-	after
-  </body>
-</html>

+ 0 - 11
tests/out/test_extends

@@ -1,11 +0,0 @@
-base-barstring
-
-base template
-
-replacing the base title
-
-more of base template
-
-replacing the base content - variable: test-barstring after variable 
-
-end of base template

+ 0 - 42
tests/out/test_filters

@@ -1,42 +0,0 @@
-Capfirst: Capitalized
-
-Centered:
-<pre>
-       center       
-</pre>
-
-Escape JS: \" \'
-
-First letter: f
-
-Fix ampersands: &amp;
-
-Force_escape: &lt;b&gt;&lt;/b&gt;
-
-Joined: eins, zwei, drei
-
-Last: t
-
-Length: 3
-
-Length is 2?: false
-
-Left adjust: 
-<pre>
-left                
-</pre>
-
-Line breaks: Line 1<br />Line 2<br />Line 3
-
-Lowercase: lowercase
-
-Plus: 2 + 2 = 4
-
-Right adjust:
-<pre>
-               right
-</pre>
-
-Uppercase: UPPERCASE
-
-URL Encode: Let%27s+go%21

+ 0 - 13
tests/out/test_for

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-<li>1. apple</li>
-
-<li>2. banana</li>
-
-<li>3. coconut</li>
-
-</ul>
-
-after

+ 0 - 7
tests/out/test_for_list

@@ -1,7 +0,0 @@
-
-More than one apple is called "apples". Only $1 each!
-
-More than one banana is called "bananas". Only $2 each!
-
-More than one coconut is called "coconuts". Only $500 each!
-

+ 0 - 7
tests/out/test_for_list_preset

@@ -1,7 +0,0 @@
-
-More than one apple is called "apples".
-
-More than one banana is called "bananas".
-
-More than one coconut is called "coconuts".
-

+ 0 - 13
tests/out/test_for_preset

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-	<li>preset-apple</li>
-
-	<li>preset-banana</li>
-
-	<li>preset-coconut</li>
-
-</ul>
-
-after

+ 0 - 13
tests/out/test_for_records

@@ -1,13 +0,0 @@
-before
-
-<ul>
-
-	<li><a href="http://amazon.com">Amazon</a></li>
-
-	<li><a href="http://google.com">Google</a></li>
-
-	<li><a href="http://microsoft.com">Microsoft</a></li>
-
-</ul>
-
-after

+ 0 - 23
tests/out/test_for_records_preset

@@ -1,23 +0,0 @@
-before
-
-<ul>
-
-	<li><a href="http://canon.com">Canon</a></li>
-
-	<li><a href="http://leica.com">Leica</a></li>
-
-	<li><a href="http://nikon.com">Nikon</a></li>
-
-</ul>
-
-<ul>
-
-	<li><a href="http://amazon.com">Amazon (preset)</a></li>
-
-	<li><a href="http://google.com">Google (preset)</a></li>
-
-	<li><a href="http://microsoft.com">Microsoft (preset)</a></li>
-
-</ul>
-
-after

+ 0 - 7
tests/out/test_for_tuple

@@ -1,7 +0,0 @@
-
-One apple, two apples!
-
-One banana, two bananas!
-
-One coconut, two coconuts!
-

+ 0 - 4
tests/out/test_if

@@ -1,4 +0,0 @@
-One but not two:  one 
-Two but not one:  two 
-One:  one 
-None: 

+ 0 - 4
tests/out/test_if_preset

@@ -1,4 +0,0 @@
-One but not two:  one 
-Two but not one:  two 
-One:  one 
-None: 

+ 0 - 28
tests/out/test_ifequal

@@ -1,28 +0,0 @@
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-
-
-else: var1="foo" and var3="bar" are not equal
-
-
-
-if: "foo" and "foo" are equal
-
-
-
-else: "foo" and "bar" are not equal
-
-
-
-if: 99 and 99 are equal
-
-
-
-else: 77 and 99 are not equal

+ 0 - 28
tests/out/test_ifequal_preset

@@ -1,28 +0,0 @@
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-if: var1="foo" and var2="foo" are equal
-
-
-
-
-
-else: var1="foo" and var3="bar" are not equal
-
-
-
-if: "foo" and "foo" are equal
-
-
-
-else: "foo" and "bar" are not equal
-
-
-
-if: 99 and 99 are equal
-
-
-
-else: 77 and 99 are not equal

+ 0 - 28
tests/out/test_ifnotequal

@@ -1,28 +0,0 @@
-
-
-
-else: var1="foo" and var2="foo" are not equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-else: "foo" and "foo" are not equal
-
-
-
-if: "foo" and "bar" are equal
-
-
-
-else: 99 and 99 are not equal
-
-
-
-if: 77 and 99 are equal

+ 0 - 28
tests/out/test_ifnotequal_preset

@@ -1,28 +0,0 @@
-
-
-
-else: var1="foo" and var2="foo" are not equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-if: var1="foo" and var3="bar" are equal
-
-
-
-else: "foo" and "foo" are not equal
-
-
-
-if: "foo" and "bar" are equal
-
-
-
-else: 99 and 99 are not equal
-
-
-
-if: 77 and 99 are equal

+ 0 - 2
tests/out/test_include

@@ -1,2 +0,0 @@
-Including another file: This is included! foostring1
-

+ 0 - 5
tests/out/test_var

@@ -1,5 +0,0 @@
-before varriable1
-foostring1
-after variable1
-foostring2
-after variable2 (HTML-comment-wrapped)

+ 0 - 9
tests/out/test_var_preset

@@ -1,9 +0,0 @@
-one
-foostring1
-two
-preset-var1
-three
-foostring2
-four
-preset-var2
-five

+ 0 - 1
tests/templates/include

@@ -1 +0,0 @@
-This is included! {{ var1 }}

+ 0 - 8
tests/templates/test_autoescape

@@ -1,8 +0,0 @@
-{% autoescape on %}
-    This is escaped: {{ var1 }}
-    {% autoescape off %}
-    This is not escaped: {{ var1 }}
-
-    This is escaped: {{ var1|escape }}
-    {% endautoescape %}
-{% endautoescape %}

+ 0 - 17
tests/templates/test_comment

@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test Comment</title>								 
-  </head>
-  <body>
-	{# comment1 #}
-	bla
-	{# comment2 #}
-        blue
-        {% comment %}
-        Block Comment
-        {% endcomment %}
-        black
-  </body>
-</html>

+ 0 - 7
tests/templates/test_custom_call

@@ -1,7 +0,0 @@
->>>> before custom call tag 'test_comment'
-{% call test_comment %}
->>>> after custom call tag 'test_comment'
-
->>>> before custom call tag 'test_if'
-{% call test_if with var1 %}
->>>> after custom call tag 'test_if'

+ 0 - 13
tests/templates/test_custom_tag

@@ -1,13 +0,0 @@
-{% load flashvideo %}
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test variable</title>								 
-  </head>
-  <body>
-	before
-	{% flashvideo dom_id="myvideo" width="800" height="600" static="/static" path_to_video="/myvid.mp4" path_to_preview_image="/mypic.jpg" %}
-	after
-  </body>
-</html>

+ 0 - 12
tests/templates/test_custom_tag_error

@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Test variable</title>								 
-  </head>
-  <body>
-	before
-	{% flashvideo dom_id="myvideo" width="800" height="600" static="/static" path_to_video="/myvid.mp4" path_to_preview_image="/mypic.jpg" %}
-	after
-  </body>
-</html>

+ 0 - 42
tests/templates/test_filters

@@ -1,42 +0,0 @@
-Capfirst: {{ "capitalized"|capfirst }}
-
-Centered:
-<pre>
-{{ "center"|center:20 }}
-</pre>
-
-Escape JS: {{ "\" '"|escapejs }}
-
-First letter: {{ "first"|first }}
-
-Fix ampersands: {{ "&"|fix_ampersands }}
-
-Force_escape: {{ "<b></b>"|force_escape }}
-
-Joined: {{ list|join:", " }}
-
-Last: {{ "last"|last }}
-
-Length: {{ list|length }}
-
-Length is 2?: {{ list|length_is:2 }}
-
-Left adjust: 
-<pre>
-{{ "left"|ljust:20 }}
-</pre>
-
-Line breaks: {{ "Line 1\nLine 2\nLine 3"|linebreaksbr }}
-
-Lowercase: {{ "LOWERCASE"|lower }}
-
-Plus: 2 + 2 = {{ 2|plus:2 }}
-
-Right adjust:
-<pre>
-{{ "right"|rjust:20 }}
-</pre>
-
-Uppercase: {{ "uppercase"|upper }}
-
-URL Encode: {{ "Let's go!"|urlencode }}

+ 0 - 9
tests/templates/test_for

@@ -1,9 +0,0 @@
-before
-
-<ul>
-{% for iterator in fruit_list %}
-<li>{{ forloop.counter }}. {{ iterator }}</li>
-{% endfor %}
-</ul>
-
-after

+ 0 - 3
tests/templates/test_for_list

@@ -1,3 +0,0 @@
-{% for singular, plural, price in fruit_list %}
-More than one {{ singular }} is called "{{ plural }}". Only {{ price }} each!
-{% endfor %}

+ 0 - 3
tests/templates/test_for_list_preset

@@ -1,3 +0,0 @@
-{% for singular, plural in fruit_list %}
-More than one {{ singular }} is called "{{ plural }}".
-{% endfor %}

+ 0 - 9
tests/templates/test_for_preset

@@ -1,9 +0,0 @@
-before
-
-<ul>
-{% for iterator in fruit_list %}
-	<li>{{ iterator }}</li>
-{% endfor %}
-</ul>
-
-after

+ 0 - 9
tests/templates/test_for_records

@@ -1,9 +0,0 @@
-before
-
-<ul>
-{% for iterator in link_list %}
-	<li><a href="{{ iterator.url }}">{{ iterator.name }}</a></li>
-{% endfor %}
-</ul>
-
-after

+ 0 - 15
tests/templates/test_for_records_preset

@@ -1,15 +0,0 @@
-before
-
-<ul>
-{% for iterator in photo_links %}
-	<li><a href="{{ iterator.url }}">{{ iterator.name }}</a></li>
-{% endfor %}
-</ul>
-
-<ul>
-{% for iterator in software_links %}
-	<li><a href="{{ iterator.url }}">{{ iterator.name }}</a></li>
-{% endfor %}
-</ul>
-
-after

+ 0 - 3
tests/templates/test_for_tuple

@@ -1,3 +0,0 @@
-{% for singular, plural in fruit_list %}
-One {{ singular }}, two {{ plural }}!
-{% endfor %}

+ 0 - 4
tests/templates/test_if

@@ -1,4 +0,0 @@
-One but not two: {% if var1 %} one {% else %} two {% endif %}
-Two but not one: {% if not var1 %} one {% else %} two {% endif %}
-One: {% if var1 %} one {% endif %}
-None: {% if var2 %} one {% endif %}

+ 0 - 4
tests/templates/test_if_preset

@@ -1,4 +0,0 @@
-One but not two: {% if var1 %} one {% else %} two {% endif %}
-Two but not one: {% if not var1 %} one {% else %} two {% endif %}
-One: {% if var1 %} one {% endif %}
-None: {% if var2 %} one {% endif %}

+ 0 - 43
tests/templates/test_ifequal

@@ -1,43 +0,0 @@
-{% ifequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% endifequal %}
-
-{% ifequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% else %}
-else: var1="foo" and var2="foo" are not equal
-{% endifequal %}
-
-{% ifequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% endifequal %}
-
-{% ifequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% else %}
-else: var1="foo" and var3="bar" are not equal
-{% endifequal %}
-
-{% ifequal "foo" "foo" %}
-if: "foo" and "foo" are equal
-{% else %}
-else: "foo" and "foo" are not equal
-{% endifequal %}
-
-{% ifequal "foo" "bar" %}
-if: "foo" and "bar" are equal
-{% else %}
-else: "foo" and "bar" are not equal
-{% endifequal %}
-
-{% ifequal 99 99 %}
-if: 99 and 99 are equal
-{% else %}
-else: 99 and 99 are not equal
-{% endifequal %}
-
-{% ifequal 77 99 %}
-if: 77 and 99 are equal
-{% else %}
-else: 77 and 99 are not equal
-{% endifequal %}

+ 0 - 43
tests/templates/test_ifequal_preset

@@ -1,43 +0,0 @@
-{% ifequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% endifequal %}
-
-{% ifequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% else %}
-else: var1="foo" and var2="foo" are not equal
-{% endifequal %}
-
-{% ifequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% endifequal %}
-
-{% ifequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% else %}
-else: var1="foo" and var3="bar" are not equal
-{% endifequal %}
-
-{% ifequal "foo" "foo" %}
-if: "foo" and "foo" are equal
-{% else %}
-else: "foo" and "foo" are not equal
-{% endifequal %}
-
-{% ifequal "foo" "bar" %}
-if: "foo" and "bar" are equal
-{% else %}
-else: "foo" and "bar" are not equal
-{% endifequal %}
-
-{% ifequal 99 99 %}
-if: 99 and 99 are equal
-{% else %}
-else: 99 and 99 are not equal
-{% endifequal %}
-
-{% ifequal 77 99 %}
-if: 77 and 99 are equal
-{% else %}
-else: 77 and 99 are not equal
-{% endifequal %}

+ 0 - 43
tests/templates/test_ifnotequal

@@ -1,43 +0,0 @@
-{% ifnotequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% else %}
-else: var1="foo" and var2="foo" are not equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% else %}
-else: var1="foo" and var3="bar" are not equal
-{% endifnotequal %}
-
-{% ifnotequal "foo" "foo" %}
-if: "foo" and "foo" are equal
-{% else %}
-else: "foo" and "foo" are not equal
-{% endifnotequal %}
-
-{% ifnotequal "foo" "bar" %}
-if: "foo" and "bar" are equal
-{% else %}
-else: "foo" and "bar" are not equal
-{% endifnotequal %}
-
-{% ifnotequal 99 99 %}
-if: 99 and 99 are equal
-{% else %}
-else: 99 and 99 are not equal
-{% endifnotequal %}
-
-{% ifnotequal 77 99 %}
-if: 77 and 99 are equal
-{% else %}
-else: 77 and 99 are not equal
-{% endifnotequal %}

+ 0 - 43
tests/templates/test_ifnotequal_preset

@@ -1,43 +0,0 @@
-{% ifnotequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var2 %}
-if: var1="foo" and var2="foo" are equal
-{% else %}
-else: var1="foo" and var2="foo" are not equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% endifnotequal %}
-
-{% ifnotequal var1 var3 %}
-if: var1="foo" and var3="bar" are equal
-{% else %}
-else: var1="foo" and var3="bar" are not equal
-{% endifnotequal %}
-
-{% ifnotequal "foo" "foo" %}
-if: "foo" and "foo" are equal
-{% else %}
-else: "foo" and "foo" are not equal
-{% endifnotequal %}
-
-{% ifnotequal "foo" "bar" %}
-if: "foo" and "bar" are equal
-{% else %}
-else: "foo" and "bar" are not equal
-{% endifnotequal %}
-
-{% ifnotequal 99 99 %}
-if: 99 and 99 are equal
-{% else %}
-else: 99 and 99 are not equal
-{% endifnotequal %}
-
-{% ifnotequal 77 99 %}
-if: 77 and 99 are equal
-{% else %}
-else: 77 and 99 are not equal
-{% endifnotequal %}

+ 0 - 1
tests/templates/test_include

@@ -1 +0,0 @@
-Including another file: {% include "include" %}

+ 0 - 5
tests/templates/test_var

@@ -1,5 +0,0 @@
-before varriable1
-{{ var1 }}
-after variable1
-<!--{{ var2 }}-->
-after variable2 (HTML-comment-wrapped)

+ 0 - 5
tests/templates/test_var_error

@@ -1,5 +0,0 @@
-before varriable1
-{{ var1 }}
-after variable1
-<!--{{ var2 }}-->
-after variable2 (HTML-comment-wrapped)

+ 0 - 9
tests/templates/test_var_preset

@@ -1,9 +0,0 @@
-one
-{{ var1 }}
-two
-{{ preset_var1 }}
-three
-<!--{{ var2 }}-->
-four
-{{ preset_var2 }}
-five