Andreas Stenius 11 лет назад
Родитель
Сommit
1a1140a004
94 измененных файлов с 4 добавлено и 3493 удалено
  1. 0 1
      Emakefile
  2. 3 17
      Makefile
  3. 1 1
      README.markdown
  4. 0 8
      tests/expect/autoescape
  5. 0 11
      tests/expect/block_super
  6. 0 15
      tests/expect/comment
  7. 0 23
      tests/expect/custom_call
  8. 0 33
      tests/expect/custom_tag
  9. 0 47
      tests/expect/cycle
  10. 0 3
      tests/expect/extend_recursive_block
  11. 0 11
      tests/expect/extends
  12. 0 14
      tests/expect/extends_path
  13. 0 10
      tests/expect/extends_path2
  14. 0 47
      tests/expect/filters
  15. 0 13
      tests/expect/for
  16. 0 7
      tests/expect/for_list
  17. 0 7
      tests/expect/for_list_preset
  18. 0 13
      tests/expect/for_preset
  19. 0 13
      tests/expect/for_records
  20. 0 23
      tests/expect/for_records_preset
  21. 0 7
      tests/expect/for_tuple
  22. 0 4
      tests/expect/if
  23. 0 4
      tests/expect/if_preset
  24. 0 28
      tests/expect/ifequal
  25. 0 28
      tests/expect/ifequal_preset
  26. 0 28
      tests/expect/ifnotequal
  27. 0 28
      tests/expect/ifnotequal_preset
  28. 0 2
      tests/expect/include
  29. 0 12
      tests/expect/include_path
  30. 0 14
      tests/expect/include_template
  31. 0 6
      tests/expect/recursive_block
  32. 0 2
      tests/expect/ssi
  33. 0 1
      tests/expect/trans
  34. 0 5
      tests/expect/var
  35. 0 9
      tests/expect/var_preset
  36. 0 8
      tests/input/autoescape
  37. 0 11
      tests/input/base
  38. 0 3
      tests/input/block_super
  39. 0 17
      tests/input/comment
  40. 0 7
      tests/input/custom_call
  41. 0 12
      tests/input/custom_tag
  42. 0 1
      tests/input/custom_tag1
  43. 0 1
      tests/input/custom_tag2
  44. 0 1
      tests/input/custom_tag3
  45. 0 1
      tests/input/custom_tag4
  46. 0 9
      tests/input/cycle
  47. 0 5
      tests/input/extend_recursive_block
  48. 0 3
      tests/input/extends
  49. 0 4
      tests/input/extends2
  50. 0 3
      tests/input/extends3
  51. 0 3
      tests/input/extends_path
  52. 0 6
      tests/input/extends_path2
  53. 0 47
      tests/input/filters
  54. 0 9
      tests/input/for
  55. 0 3
      tests/input/for_list
  56. 0 3
      tests/input/for_list_preset
  57. 0 9
      tests/input/for_preset
  58. 0 9
      tests/input/for_records
  59. 0 15
      tests/input/for_records_preset
  60. 0 3
      tests/input/for_tuple
  61. 0 4
      tests/input/if
  62. 0 4
      tests/input/if_preset
  63. 0 43
      tests/input/ifequal
  64. 0 43
      tests/input/ifequal_preset
  65. 0 43
      tests/input/ifnotequal
  66. 0 43
      tests/input/ifnotequal_preset
  67. 0 1
      tests/input/include
  68. 0 1
      tests/input/include.html
  69. 0 5
      tests/input/include_path
  70. 0 3
      tests/input/include_template
  71. 0 11
      tests/input/now
  72. 0 6
      tests/input/path1/base1
  73. 0 5
      tests/input/path1/base2
  74. 0 1
      tests/input/path1/include1
  75. 0 5
      tests/input/path1/template1
  76. 0 14
      tests/input/path2/base2
  77. 0 2
      tests/input/path2/template2
  78. 0 6
      tests/input/recursive_block
  79. 0 1
      tests/input/ssi
  80. 0 1
      tests/input/ssi_include.html
  81. 0 1
      tests/input/trans
  82. 0 5
      tests/input/var
  83. 0 9
      tests/input/var_preset
  84. 0 15
      tests/src/erlydtl_custom_tags.erl
  85. 0 250
      tests/src/erlydtl_dateformat_tests.erl
  86. 0 10
      tests/src/erlydtl_example_variable_storage.erl
  87. 0 31
      tests/src/erlydtl_extension_test.erl
  88. 0 153
      tests/src/erlydtl_extension_testparser.yrl
  89. 0 345
      tests/src/erlydtl_functional_tests.erl
  90. 0 14
      tests/src/erlydtl_lib_test1.erl
  91. 0 9
      tests/src/erlydtl_lib_testversion.erl
  92. 0 1656
      tests/src/erlydtl_unittests.erl
  93. 0 10
      tests/src/gettext.erl
  94. 0 55
      tests/src/sources_parser_unittests.erl

+ 0 - 1
Emakefile

@@ -1 +0,0 @@
-{"tests/src/*", [debug_info, {outdir, "ebintest"}, {i, "include"}]}.

+ 3 - 17
Makefile

@@ -17,25 +17,11 @@ get-deps:
 update-deps:
 	@$(REBAR) update-deps
 
-compile_test:
-	-mkdir -p ebintest
-	$(ERLC) -o tests/src -I include/erlydtl_preparser.hrl \
-		tests/src/erlydtl_extension_testparser.yrl
-	$(ERL) -pa ebin -make
-
-test: compile compile_test
-	$(ERL) -noshell -pa ebin -pa ebintest -pa deps/merl/ebin \
-		-eval \
-		"try \
-			erlydtl_functional_tests:run_tests(), \
-			erlydtl_dateformat_tests:run_tests(), \
-			erlydtl_unittests:run_tests(), \
-			sources_parser_unittests:run_tests(), \
-			halt(0) \
-		catch throw:failed -> halt(1) end"
+.PHONY: tests
+tests:
 	@$(REBAR) eunit
 
-check: test dialyze
+check: tests dialyze
 
 DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions -Wunmatched_returns
 dialyze:

+ 1 - 1
README.markdown

@@ -320,7 +320,7 @@ Tests
 
 From a Unix shell, run:
 
-    make test
+    make tests
 
 Note that the tests will create some output in tests/output in case of regressions.
 

+ 0 - 8
tests/expect/autoescape

@@ -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 - 11
tests/expect/block_super

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

+ 0 - 15
tests/expect/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 - 23
tests/expect/custom_call

@@ -1,23 +0,0 @@
->>>> before custom call tag 'comment'
-before
-
-<ul>
-
-	<li>preset-apple</li>
-
-	<li>preset-banana</li>
-
-	<li>preset-coconut</li>
-
-</ul>
-
-after
->>>> after custom call tag 'comment'
-
->>>> before custom call tag 'if'
-One but not two:  two 
-Two but not one:  one 
-One: 
-None: 
-
->>>> after custom call tag 'if'

+ 0 - 33
tests/expect/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 - 47
tests/expect/cycle

@@ -1,47 +0,0 @@
-before
-
-<ul>
-
-<li>1. 1 - Apple</li>
-
-<li>2. 2 - Banana</li>
-
-<li>3. 3 - Cherry</li>
-
-<li>4. 4 - Apple</li>
-
-<li>5. 5 - Banana</li>
-
-<li>6. 6 - Cherry</li>
-
-<li>7. 7 - Apple</li>
-
-<li>8. 8 - Banana</li>
-
-<li>9. 9 - Cherry</li>
-
-<li>10. 10 - Apple</li>
-
-<li>11. 11 - Banana</li>
-
-<li>12. 12 - Cherry</li>
-
-<li>13. 13 - Apple</li>
-
-<li>14. 14 - Banana</li>
-
-<li>15. 15 - Cherry</li>
-
-<li>16. 16 - Apple</li>
-
-<li>17. 17 - Banana</li>
-
-<li>18. 18 - Cherry</li>
-
-<li>19. 19 - Apple</li>
-
-<li>20. 20 - Banana</li>
-
-</ul>
-
-after

+ 0 - 3
tests/expect/extend_recursive_block

@@ -1,3 +0,0 @@
-
-    extended content
-

+ 0 - 11
tests/expect/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 - 14
tests/expect/extends_path

@@ -1,14 +0,0 @@
-base-barstring
-
-base2 template
-
-replacing the base title
-block title 2 from  base1 
-
-more of base2 template
-
-replacing the base content - variable: test-barstring after variable 
-
-block content2 in base 2, should pass through
-
-end of base2 template

+ 0 - 10
tests/expect/extends_path2

@@ -1,10 +0,0 @@
-pre content
-
-
-start_content
-This is include1
-
-end_content
-
-
-post

+ 0 - 47
tests/expect/filters

@@ -1,47 +0,0 @@
-
-Add: 2 + 2 = 4
-
-Capfirst: Capitalized
-
-Centered:
-<pre>
-       center       
-</pre>
-
-Date format:  Thu, 24 Jul 1975
-DateTime format: Thu, 24 Jul 1975 07:13:01
-
-Escape JS: \u0022 \u0027
-
-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
-
-Right adjust:
-<pre>
-               right
-</pre>
-
-Uppercase: UPPERCASE
-
-URL Encode: Let%27s%20go%21
-

+ 0 - 13
tests/expect/for

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

+ 0 - 7
tests/expect/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/expect/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/expect/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/expect/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/expect/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/expect/for_tuple

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

+ 0 - 4
tests/expect/if

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

+ 0 - 4
tests/expect/if_preset

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

+ 0 - 28
tests/expect/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/expect/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/expect/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/expect/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/expect/include

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

+ 0 - 12
tests/expect/include_path

@@ -1,12 +0,0 @@
-main file
-
-This is template 1.
-
-test-barstring
-
-
-This is template 2
-
-
-
-base-barstring

+ 0 - 14
tests/expect/include_template

@@ -1,14 +0,0 @@
-Including another template: base-barstring
-
-base template
-
-base title
-
-more of base template
-
-base content
-
-end of base template
-
-
-test variable: test-barstring

+ 0 - 6
tests/expect/recursive_block

@@ -1,6 +0,0 @@
-
-    testing: <br />
-    
-    <br />
-    end testing<br />
-

+ 0 - 2
tests/expect/ssi

@@ -1,2 +0,0 @@
-{{ "Don't evaluate me!" }}
-

+ 0 - 1
tests/expect/trans

@@ -1 +0,0 @@
-Example String

+ 0 - 5
tests/expect/var

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

+ 0 - 9
tests/expect/var_preset

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

+ 0 - 8
tests/input/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 - 11
tests/input/base

@@ -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
tests/input/block_super

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

+ 0 - 17
tests/input/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/input/custom_call

@@ -1,7 +0,0 @@
->>>> before custom call tag 'comment'
-{% call functional_test_for_preset %}
->>>> after custom call tag 'comment'
-
->>>> before custom call tag 'if'
-{% call functional_test_if with var1 %}
->>>> after custom call tag 'if'

+ 0 - 12
tests/input/custom_tag

@@ -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" alt=_("Get Adobe Flash player") %}
-	after
-  </body>
-</html>

+ 0 - 1
tests/input/custom_tag1

@@ -1 +0,0 @@
-{% custom1 %}

+ 0 - 1
tests/input/custom_tag2

@@ -1 +0,0 @@
-{% custom2 %}

+ 0 - 1
tests/input/custom_tag3

@@ -1 +0,0 @@
-{% custom3 %}

+ 0 - 1
tests/input/custom_tag4

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

+ 0 - 9
tests/input/cycle

@@ -1,9 +0,0 @@
-before
-
-<ul>
-{% for i in test %}
-<li>{{ forloop.counter }}. {{ i }} - {% cycle a b c %}</li>
-{% endfor %}
-</ul>
-
-after

+ 0 - 5
tests/input/extend_recursive_block

@@ -1,5 +0,0 @@
-{% extends "recursive_block" %}
-
-{% block content %}
-    extended content
-{% endblock %}

+ 0 - 3
tests/input/extends

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

+ 0 - 4
tests/input/extends2

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

+ 0 - 3
tests/input/extends3

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

+ 0 - 3
tests/input/extends_path

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

+ 0 - 6
tests/input/extends_path2

@@ -1,6 +0,0 @@
-{% extends "path1/base2" %}
-{% block content %}
-start_content
-{% include "path1/include1" %}
-end_content
-{% endblock %}

+ 0 - 47
tests/input/filters

@@ -1,47 +0,0 @@
-{% autoescape off %}
-Add: 2 + 2 = {{ 2|add:2 }}
-
-Capfirst: {{ "capitalized"|capfirst }}
-
-Centered:
-<pre>
-{{ "center"|center:20 }}
-</pre>
-
-Date format:  {{ date_var1|date:"D, d M Y" }}
-DateTime format: {{ datetime_var1|date:"D, d M Y H:i:s" }}
-
-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 }}
-
-Right adjust:
-<pre>
-{{ "right"|rjust:20 }}
-</pre>
-
-Uppercase: {{ "uppercase"|upper }}
-
-URL Encode: {{ "Let's go!"|urlencode }}
-{% endautoescape %}

+ 0 - 9
tests/input/for

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

+ 0 - 3
tests/input/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/input/for_list_preset

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

+ 0 - 9
tests/input/for_preset

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

+ 0 - 9
tests/input/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/input/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/input/for_tuple

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

+ 0 - 4
tests/input/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/input/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/input/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/input/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/input/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/input/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/input/include

@@ -1 +0,0 @@
-Including another file: {% include "include.html" with var1=var1 only %}

+ 0 - 1
tests/input/include.html

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

+ 0 - 5
tests/input/include_path

@@ -1,5 +0,0 @@
-main file
-
-{% ssi "path1/template1" parsed %}
-
-{{ base_var }}

+ 0 - 3
tests/input/include_template

@@ -1,3 +0,0 @@
-Including another template: {% include "base" %}
-
-test variable: {{ test_var }}

+ 0 - 11
tests/input/now

@@ -1,11 +0,0 @@
-Expected format : Thu, 21 Dec 2000 16:01:07 +0200
-Got : {% now "r" %}
-
-Expected format : 27th February 2008 01:24
-Got : {% now "jS F Y H:i" %}
-
-Expected format : It is the 4th of September 2007
-Got : It is the {% now "jS o\f F Y" %}
-
-Expected format : ''
-Got : '{% now "" %}'

+ 0 - 6
tests/input/path1/base1

@@ -1,6 +0,0 @@
-{% extends "path2/base2" %}
-
-{% block title2 %}block title 2 from  base1 {% endblock %}
-
-
-

+ 0 - 5
tests/input/path1/base2

@@ -1,5 +0,0 @@
-pre content
-
-{% block content %}default content{% endblock %}
-
-post

+ 0 - 1
tests/input/path1/include1

@@ -1 +0,0 @@
-This is include1

+ 0 - 5
tests/input/path1/template1

@@ -1,5 +0,0 @@
-This is template 1.
-
-{{ test_var }}
-
-{% include "path2/template2" %}

+ 0 - 14
tests/input/path2/base2

@@ -1,14 +0,0 @@
-{{ base_var }}
-
-base2 template
-
-{% block title %}block title in base2, should be hidden by main template{% endblock %}
-{% block title2 %}block title2 in base2, should be hidden by base1{% endblock %}
-
-more of base2 template
-
-{% block content %}block content in base 2, should be overwritten{% endblock %}
-
-{% block content2 %}block content2 in base 2, should pass through{% endblock %}
-
-end of base2 template

+ 0 - 2
tests/input/path2/template2

@@ -1,2 +0,0 @@
-
-This is template 2

+ 0 - 6
tests/input/recursive_block

@@ -1,6 +0,0 @@
-{% block content %}
-    testing: <br />
-    {% block content %}{% endblock %}
-    <br />
-    end testing<br />
-{% endblock %}

+ 0 - 1
tests/input/ssi

@@ -1 +0,0 @@
-{% ssi path %}

+ 0 - 1
tests/input/ssi_include.html

@@ -1 +0,0 @@
-{{ "Don't evaluate me!" }}

+ 0 - 1
tests/input/trans

@@ -1 +0,0 @@
-{% trans "Example String" %}

+ 0 - 5
tests/input/var

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

+ 0 - 9
tests/input/var_preset

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

+ 0 - 15
tests/src/erlydtl_custom_tags.erl

@@ -1,15 +0,0 @@
--module(erlydtl_custom_tags).
-
--export([custom1/1, custom2/2, custom3/2, custom4/1]).
-
-custom1(_TagVars = []) ->
-    <<"b1">>.
-
-custom2([], _RenderOptions = [{locale, ru}, {foo, bar}]) ->
-    <<"b2">>.
-
-custom3([], _RenderOptions = [{locale, ru}]) ->
-    <<"b3">>.
-
-custom4(_TagVars = [<<"a">>]) ->
-    <<"a">>.

+ 0 - 250
tests/src/erlydtl_dateformat_tests.erl

@@ -1,250 +0,0 @@
--module(erlydtl_dateformat_tests).
-
--export([run_tests/0]).
-
-run_tests() ->
-   io:format("Running date format tests...~n"),
-   Failures = test_group_runner([
-      {
-         "date 1",
-         {1979, 7, 8}, % just a date
-         [{"a", "a.m."}, {"A", "AM"}, {"c", "1979-07-08T00:00:00"},
-          {"d", "08"}, {"D", "Sun"}, {"f", "12"}, {"F", "July"},
-          {"g", "12"}, {"G", "0"},
-          {"h", "12"}, {"H", "00"}, {"i", "00"},
-          {"j", "8"}, {"l", "Sunday"}, {"L", "False"},
-          {"m", "07"}, {"M", "Jul"}, {"b", "jul"},
-          {"n", "7"}, {"N", "July"}, {"P", "midnight"},
-          {"s", "00"}, {"S", "th"}, {"t", "31"},
-          {"w", "0"}, {"W", "27"}, {"y", "79"}, {"Y", "1979"}, {"z", "189"},
-          {"jS F Y H:i", "8th July 1979 00:00"},
-          {"jS \\o\\f F", "8th of July"},
-          % We expect these to come back verbatim
-          {"x", "x"}, {"C", "C"}, {";", ";"}, {"%", "%"}
-
-          % TODO : timzeone related tests.
-          %{"r", "Sun, 8 Jul 1979 00:00:00 +0000"},
-          %{"O", "0000"},
-          %{"T", "CET"},
-          %{"U", "300531600"},
-          %{"Z", "3600"}
-         ]
-      },
-      {
-         "datetime 1",
-         {{1979, 7, 8}, {22, 7, 12}}, % date/time tuple
-         [{"a", "p.m."}, {"A", "PM"}, {"c", "1979-07-08T22:07:12"},
-          {"d", "08"}, {"D", "Sun"}, {"f", "10:07"}, {"F", "July"},
-          {"g", "10"}, {"G", "22"},
-          {"h", "10"}, {"H", "22"}, {"i", "07"},
-          {"j", "8"}, {"l", "Sunday"}, {"L", "False"},
-          {"m", "07"}, {"M", "Jul"}, {"b", "jul"},
-          {"n", "7"}, {"N", "July"}, {"P", "10:07 p.m."},
-          {"s", "12"}, {"S", "th"}, {"t", "31"},
-          {"w", "0"}, {"W", "27"}, {"y", "79"}, {"Y", "1979"}, {"z", "189"},
-          {"jS F Y H:i", "8th July 1979 22:07"},
-          {"jS \\o\\f F", "8th of July"},
-          % We expect these to come back verbatim
-          {"x", "x"}, {"C", "C"}, {";", ";"}, {"%", "%"}
-          % TODO : timzeone related tests.
-          %{"r", "Sun, 8 Jul 1979 22:07:12 +0000"},
-          %{"O", "0000"},
-          %{"T", "CET"},
-          %{"U", "300531600"},
-          %{"Z", "3600"}
-         ]
-      },
-      {
-         "datetime 2",
-         {{2008, 12, 25}, {7, 0, 9}}, % date/time tuple
-         [{"a", "a.m."}, {"A", "AM"}, {"c", "2008-12-25T07:00:09"},
-          {"d", "25"}, {"D", "Thu"}, {"f", "7"}, {"F", "December"},
-          {"g", "7"}, {"G", "7"},
-          {"h", "07"}, {"H", "07"}, {"i", "00"},
-          {"j", "25"}, {"l", "Thursday"}, {"L", "True"},
-          {"m", "12"}, {"M", "Dec"}, {"b", "dec"},
-          {"n", "12"}, {"N", "Dec."}, {"P", "7 a.m."},
-          {"s", "09"}, {"S", "th"}, {"t", "31"},
-          {"w", "4"}, {"W", "52"}, {"y", "08"}, {"Y", "2008"}, {"z", "360"},
-          {"jS F Y H:i", "25th December 2008 07:00"},
-          {"jS \\o\\f F", "25th of December"},
-          % We expect these to come back verbatim
-          {"x", "x"}, {"C", "C"}, {";", ";"}, {"%", "%"}
-          % TODO : timzeone related tests.
-          %{"r", "Thu, 25 Dec 2008 07:00:09 +0000"},
-          %{"O", "0000"},
-          %{"T", "CET"},
-          %{"U", "300531600"},
-          %{"Z", "3600"}
-         ]
-      },
-      {
-         "datetime 3",
-         {{2004, 2, 29}, {12, 0, 59}}, % date/time tuple
-         [{"a", "p.m."}, {"A", "PM"}, {"c", "2004-02-29T12:00:59"},
-          {"d", "29"}, {"D", "Sun"}, {"f", "12"}, {"F", "February"},
-          {"g", "12"}, {"G", "12"},
-          {"h", "12"}, {"H", "12"}, {"i", "00"},
-          {"j", "29"}, {"l", "Sunday"}, {"L", "True"},
-          {"m", "02"}, {"M", "Feb"}, {"b", "feb"},
-          {"n", "2"}, {"N", "Feb."}, {"P", "noon"},
-          {"s", "59"}, {"S", "th"}, {"t", "29"},
-          {"w", "0"}, {"W", "9"}, {"y", "04"}, {"Y", "2004"}, {"z", "58"},
-          {"jS F Y H:i", "29th February 2004 12:00"},
-          {"jS \\o\\f F", "29th of February"},
-          % We expect these to come back verbatim
-          {"x", "x"}, {"C", "C"}, {";", ";"}, {"%", "%"}
-          % TODO : timzeone related tests.
-          %{"r", "Sun, 29 Feb 2004 12:00:59 +0000"},
-          %{"O", "0000"},
-          %{"T", "CET"},
-          %{"U", "300531600"},
-          %{"Z", "3600"}
-         ]
-      },
-      {
-         "datetime 4",
-         {{2004, 2, 29}, {12, 0, 09.256687}}, % date/time tuple
-         [{"a", "p.m."}, {"A", "PM"}, {"c", "2004-02-29T12:00:09"},
-          {"d", "29"}, {"D", "Sun"}, {"f", "12"}, {"F", "February"},
-          {"g", "12"}, {"G", "12"},
-          {"h", "12"}, {"H", "12"}, {"i", "00"},
-          {"j", "29"}, {"l", "Sunday"}, {"L", "True"},
-          {"m", "02"}, {"M", "Feb"}, {"b", "feb"},
-          {"n", "2"}, {"N", "Feb."}, {"P", "noon"},
-          {"s", "09"}, {"S", "th"}, {"t", "29"},
-          {"w", "0"}, {"W", "9"}, {"y", "04"}, {"Y", "2004"}, {"z", "58"},
-          {"jS F Y H:i", "29th February 2004 12:00"},
-          {"jS \\o\\f F", "29th of February"},
-          % We expect these to come back verbatim
-          {"x", "x"}, {"C", "C"}, {";", ";"}, {"%", "%"}
-          % TODO : timzeone related tests.
-          %{"r", "Sun, 29 Feb 2004 12:00:59 +0000"},
-          %{"O", "0000"},
-          %{"T", "CET"},
-          %{"U", "300531600"},
-          %{"Z", "3600"}
-         ]
-      },
-      % Weeknum tests.  Largely based on examples from :
-      %   http://en.wikipedia.org/wiki/ISO_week_date
-      { "weeknum 1.1",  {2005,  1,  1}, [{"W", "53"}] },
-      { "weeknum 1.2",  {2005,  1,  2}, [{"W", "53"}] },
-      { "weeknum 1.3",  {2005, 12, 31}, [{"W", "52"}] },
-      { "weeknum 1.4",  {2007,  1,  1}, [{"W", "1"}]  },
-      { "weeknum 1.5",  {2007, 12, 30}, [{"W", "52"}] },
-      { "weeknum 1.6",  {2007, 12, 31}, [{"W", "1"}]  },
-      { "weeknum 1.6",  {2008,  1,  1}, [{"W", "1"}]  },
-      { "weeknum 1.7",  {2008, 12, 29}, [{"W", "1"}]  },
-      { "weeknum 1.8",  {2008, 12, 31}, [{"W", "1"}]  },
-      { "weeknum 1.9",  {2009,  1,  1}, [{"W", "1"}]  },
-      { "weeknum 1.10", {2009, 12, 31}, [{"W", "53"}] },
-      { "weeknum 1.11", {2010,  1,  3}, [{"W", "53"}] },
-      % Examples where the ISO year is three days into
-      % the next Gregorian year
-      { "weeknum 2.1",  {2009, 12, 31}, [{"W", "53"}] },
-      { "weeknum 2.2",  {2010,  1,  1}, [{"W", "53"}] },
-      { "weeknum 2.3",  {2010,  1,  2}, [{"W", "53"}] },
-      { "weeknum 2.4",  {2010,  1,  3}, [{"W", "53"}] },
-      { "weeknum 2.5",  {2010,  1,  5}, [{"W", "1"}] },
-      % Example where the ISO year is three days into
-      % the previous Gregorian year
-      { "weeknum 3.1",  {2008, 12, 28}, [{"W", "52"}] },
-      { "weeknum 3.2",  {2008, 12, 29}, [{"W", "1"}] },
-      { "weeknum 3.3",  {2008, 12, 30}, [{"W", "1"}] },
-      { "weeknum 3.4",  {2008, 12, 31}, [{"W", "1"}] },
-      { "weeknum 3.5",  {2009,  1,  1}, [{"W", "1"}] },
-      % freeform tests
-      { "weeknum 4.1",  {2008,  2, 28}, [{"W", "9"}] },
-      { "weeknum 4.2",  {1975,  7, 24}, [{"W","30"}] },
-
-      % Yearweek tests.  Largely based on examples from :
-      %   http://en.wikipedia.org/wiki/ISO_week_date
-      { "weeknum_year 1.1",  {2005,  1,  1}, [{"o", "2004"}] },
-      { "weeknum_year 1.2",  {2005,  1,  2}, [{"o", "2004"}] },
-      { "weeknum_year 1.3",  {2005, 12, 31}, [{"o", "2005"}] },
-      { "weeknum_year 1.4",  {2007,  1,  1}, [{"o", "2007"}]  },
-      { "weeknum_year 1.5",  {2007, 12, 30}, [{"o", "2007"}] },
-      { "weeknum_year 1.6",  {2007, 12, 31}, [{"o", "2008"}]  },
-      { "weeknum_year 1.6",  {2008,  1,  1}, [{"o", "2008"}]  },
-      { "weeknum_year 1.7",  {2008, 12, 29}, [{"o", "2009"}]  },
-      { "weeknum_year 1.8",  {2008, 12, 31}, [{"o", "2009"}]  },
-      { "weeknum_year 1.9",  {2009,  1,  1}, [{"o", "2009"}]  },
-      { "weeknum_year 1.10", {2009, 12, 31}, [{"o", "2009"}] },
-      { "weeknum_year 1.11", {2010,  1,  3}, [{"o", "2009"}] },
-      % Examples where the ISO year is three days into
-      % the next Gregorian year
-      { "weeknum_year 2.1",  {2009, 12, 31}, [{"o", "2009"}] },
-      { "weeknum_year 2.2",  {2010,  1,  1}, [{"o", "2009"}] },
-      { "weeknum_year 2.3",  {2010,  1,  2}, [{"o", "2009"}] },
-      { "weeknum_year 2.4",  {2010,  1,  3}, [{"o", "2009"}] },
-      { "weeknum_year 2.5",  {2010,  1,  5}, [{"o", "2010"}] },
-      % Example where the ISO year is three days into
-      % the previous Gregorian year
-      { "weeknum_year 3.1",  {2008, 12, 28}, [{"o", "2008"}] },
-      { "weeknum_year 3.2",  {2008, 12, 29}, [{"o", "2009"}] },
-      { "weeknum_year 3.3",  {2008, 12, 30}, [{"o", "2009"}] },
-      { "weeknum_year 3.4",  {2008, 12, 31}, [{"o", "2009"}] },
-      { "weeknum_year 3.5",  {2009,  1,  1}, [{"o", "2009"}] },
-      % freeform tests
-      { "weeknum_year 4.1",  {2008,  2, 28}, [{"o", "2008"}] },
-      { "weeknum_year 4.2",  {1975,  7, 24}, [{"o", "1975"}] },
-
-      % Ordinal suffix tests.
-      { "Ordinal suffix 1", {1984,1,1},  [{"S", "st"}] },
-      { "Ordinal suffix 2", {1984,2,2},  [{"S", "nd"}] },
-      { "Ordinal suffix 3", {1984,3,3},  [{"S", "rd"}] },
-      { "Ordinal suffix 4", {1984,4,4},  [{"S", "th"}] },
-      { "Ordinal suffix 5", {1984,6,5},  [{"S", "th"}] },
-      { "Ordinal suffix 7", {1984,2,9},  [{"S", "th"}] },
-      { "Ordinal suffix 8", {1984,9,9},  [{"S", "th"}] },
-      { "Ordinal suffix 9", {1984,11,10}, [{"S", "th"}] },
-      { "Ordinal suffix 10", {1984,12,11}, [{"S", "th"}] },
-      { "Ordinal suffix 11", {1984,8,12}, [{"S", "th"}] },
-      { "Ordinal suffix 12", {1984,1,19}, [{"S", "th"}] },
-      { "Ordinal suffix 13", {1984,2,20}, [{"S", "th"}] },
-      { "Ordinal suffix 14", {1984,2,21}, [{"S", "st"}] },
-      { "Ordinal suffix 15", {1984,7,22}, [{"S", "nd"}] },
-      { "Ordinal suffix 16", {1984,6,23}, [{"S", "rd"}] },
-      { "Ordinal suffix 17", {1984,5,24}, [{"S", "th"}] },
-      { "Ordinal suffix 18", {1984,1,29}, [{"S", "th"}] },
-      { "Ordinal suffix 19", {1984,3,30}, [{"S", "th"}] },
-      { "Ordinal suffix 20", {1984,1,31}, [{"S", "st"}] },
-      { "Ordinal suffix 21", {1984,1,310}, [{"S", "th"}] },
-      { "Ordinal suffix 22", {1984,1,121}, [{"S", "st"}] }
-   ]),
-
-    if Failures == 0 ->
-            io:format("All Date format tests PASS~n~n");
-       true ->
-            io:format("Date format failures: ~p~n~n", [Failures]),
-            throw(failed)
-    end.
-
-test_group_runner([]) -> 0;
-test_group_runner([{Info, DateParam, Tests} | Rest]) ->
-   io:format(" Test ~p -> ", [Info]),
-   PassCount = test_runner(DateParam, Tests),
-   case PassCount =:= length(Tests) of
-       true ->
-           io:format("Passed ~p/~p~n", [PassCount, length(Tests)]);
-       _ ->
-           io:format("~nFailed ~p/~p~n", [length(Tests) - PassCount, length(Tests)])
-   end,
-   test_group_runner(Rest) + length(Tests) - PassCount.
-
-test_runner(DateParam, Tests) ->
-    test_runner(DateParam, Tests, 1, 0).
-test_runner(_DateParam, [], _TestNum, PassCount) ->
-    PassCount;
-test_runner(DateParam, [{Input, Expect} | Rest], TestNum, PassCount) ->
-    Text = "'" ++ Input ++ "' -> '" ++ Expect ++ "'",
-    IsPass = is(TestNum, Text, erlydtl_dateformat:format(DateParam, Input), Expect),
-    test_runner(DateParam, Rest, TestNum + 1, PassCount + IsPass).
-    
-is(_TestNum, _Text, Input1, Input2) when Input1 =:= Input2 ->
-    1;
-is(TestNum, Text, Input1, Input2) -> 
-    io:format("~nnot ok ~p - ~s~n     got : ~p~n expected : ~p", [
-       TestNum, Text, Input1, Input2]),
-    0.

+ 0 - 10
tests/src/erlydtl_example_variable_storage.erl

@@ -1,10 +0,0 @@
--module(erlydtl_example_variable_storage).
--compile(export_all).
-
-% fake pmod
-
-new(SomeVar) ->
-    {?MODULE, SomeVar}.
-
-some_var({?MODULE, SomeVar}) ->
-    SomeVar.

+ 0 - 31
tests/src/erlydtl_extension_test.erl

@@ -1,31 +0,0 @@
--module(erlydtl_extension_test).
-
--export([scan/1, parse/1, compile_ast/2]).
--include("erlydtl_ext.hrl").
-
-%% look for a foo identifer followed by a #
-scan(#scanner_state{ template="#" ++ T, 
-		     scanned=[{identifier, Loc, foo}|Scanned],
-		     pos={L,C} }=S) ->
-    %% return new state with the hash dropped, and the foo identifer replaced with bar
-    {ok, S#scanner_state{ template=T,
-			  scanned=[{identifier, Loc, "rab"}|Scanned],
-			  pos={L, C+1} }};
-scan(#scanner_state{ template="#" ++ _T, pos={L, C} }) ->
-    %% give error when # not follows foo
-    {error, {L,?MODULE,lists:concat(["Unexpected '#' in code at column ", C])}};
-scan(_) -> 
-    %% for anything else, fallback to the error message from erlydtl_scanner..
-    undefined.
-
-parse(State) ->
-    erlydtl_extension_testparser:resume(State).
-
-%% {{ varA or varB }} is equivalent to {% if varA %}{{ varA }}{% else %}{{ varB }}{% endif %}
-compile_ast({value_or, {Value1, Value2}}, TreeWalker) ->
-    {{V1_Ast, V1_Info}, TW1} = erlydtl_beam_compiler:value_ast(Value1, false, false, TreeWalker),
-    {{V2_Ast, V2_Info}, TW2} = erlydtl_beam_compiler:value_ast(Value2, false, false, TW1),
-    {{erl_syntax:case_expr(V1_Ast,
-                           [erl_syntax:clause([erl_syntax:atom(undefined)], none, [V2_Ast]),
-                            erl_syntax:clause([erl_syntax:underscore()], none, [V1_Ast])
-                           ]), erlydtl_compiler_utils:merge_info(V1_Info, V2_Info)}, TW2}.

+ 0 - 153
tests/src/erlydtl_extension_testparser.yrl

@@ -1,153 +0,0 @@
-%%% -*- mode: erlang -*- ------------------------------------------------------------------
-%%% File:      erlydtl_parser.erl
-%%% @author    Andreas Stenius <kaos@astekk.se>
-%%% @copyright 2013 Andreas Stenius
-%%% @doc Sample extension grammar
-%%% @reference  See <a href="http://erlydtl.googlecode.com" target="_top">http://erlydtl.googlecode.com</a> for more information
-%%% @end  
-%%%
-%%% The MIT License
-%%%
-%%% Copyright (c) 2013 Andreas Stenius
-%%%
-%%% 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 2013-06-20 by Andreas Stenius
-%%%-------------------------------------------------------------------
-
-Nonterminals
-    Extensions
-    Literal
-
-    ValueExpressionBraced
-
-    ValueExpression
-    Value
-    Variable
-.
-    
-Terminals
-    %% "new" terminals that are partially parsed tokens from the erlydtl parser:
-    variable
-
-    %% standard scanner tokens:
-
-    %% and_keyword
-    %% as_keyword
-    %% autoescape_keyword
-    %% block_keyword
-    %% blocktrans_keyword
-    %% by_keyword
-    %% call_keyword
-    %% close_tag
-    close_var
-    %% comment_keyword
-    %% cycle_keyword
-    %% elif_keyword
-    %% else_keyword
-    %% empty_keyword
-    %% endautoescape_keyword
-    %% endblock_keyword
-    %% endblocktrans_keyword
-    %% endcomment_keyword
-    %% endfilter_keyword
-    %% endfor_keyword
-    %% endif_keyword
-    %% endifchanged_keyword
-    %% endifequal_keyword
-    %% endifnotequal_keyword
-    %% endregroup_keyword
-    %% endspaceless_keyword
-    %% endwith_keyword
-    %% extends_keyword
-    %% filter_keyword
-    %% firstof_keyword
-    %% for_keyword
-    identifier
-    %% if_keyword
-    %% ifchanged_keyword
-    %% ifequal_keyword
-    %% ifnotequal_keyword
-    %% in_keyword
-    %% include_keyword
-    %% noop_keyword
-    %% not_keyword
-    %% now_keyword
-    number_literal
-    %% only_keyword
-    or_keyword
-    %% open_tag
-    open_var
-    %% parsed_keyword
-    %% regroup_keyword
-    %% reversed_keyword
-    %% spaceless_keyword
-    %% ssi_keyword
-    string_literal
-    %% string
-    %% templatetag_keyword
-    %% openblock_keyword
-    %% closeblock_keyword
-    %% openvariable_keyword
-    %% closevariable_keyword
-    %% openbrace_keyword
-    %% closebrace_keyword
-    %% opencomment_keyword
-    %% closecomment_keyword
-    %% trans_keyword
-    %% widthratio_keyword
-    %% with_keyword
-    %% ',' '|' '=' ':' 
-    '.'
-    %% '==' '!='
-    %% '>=' '<='
-    %% '>' '<'
-    %% '(' ')'
-    %% '_'
-.
-
-Rootsymbol
-    Extensions.
-
-%% Operator precedences for the E non terminal
-Left 100 or_keyword.
-%Left 110 and_keyword.
-%Nonassoc 300 '==' '!=' '>=' '<=' '>' '<'.
-%Unary 600 Unot.
-
-Extensions -> ValueExpressionBraced : ['$1'].
-
-ValueExpressionBraced -> open_var ValueExpression close_var : '$2'.
-
-ValueExpression -> Value or_keyword Value : {extension, {value_or, {'$1', '$3'}}}.
-    
-%Value -> Value '|' Filter : {apply_filter, '$1', '$3'}.
-%Value -> '_' '(' Value ')' : {trans, '$3'}.
-Value -> Variable : '$1'.
-Value -> Literal : '$1'.
-    
-Variable -> identifier : {variable, '$1'}.
-Variable -> variable : '$1'.
-Variable -> Variable '.' identifier : {attribute, {'$3', '$1'}}.
-
-Literal -> string_literal : '$1'.
-Literal -> number_literal : '$1'.
-
-
-%% vim: syntax=erlang

+ 0 - 345
tests/src/erlydtl_functional_tests.erl

@@ -1,345 +0,0 @@
-%%%-------------------------------------------------------------------
-%%% File:      erlydtl_tests.erl
-%%% @author    Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
-%%% @author    Evan Miller <emmiller@gmail.com>
-%%% @copyright 2008 Roberto Saccon, Evan Miller
-%%% @doc       ErlyDTL 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 2008-02-11 by Roberto Saccon
-%%%-------------------------------------------------------------------
--module(erlydtl_functional_tests).
--author('rsaccon@gmail.com').
--author('emmiller@gmail.com').
-
-
-%% API
--export([run_tests/0, run_test/1]).
-
-test_list() ->
-    %% order is important.
-    ["autoescape", "comment", "extends", "filters", "for", "for_list",
-     "for_tuple", "for_list_preset", "for_preset", "for_records",
-     "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_tag4", "custom_call",
-     "include_template", "include_path", "ssi", "extends_path",
-     "extends_path2", "trans", "extends2", "extends3",
-     "recursive_block", "extend_recursive_block", "missing",
-     "block_super"
-    ].
-
-setup_compile("for_list_preset") ->
-    CompileVars = [{fruit_list, [["apple", "apples"], ["banana", "bananas"], ["coconut", "coconuts"]]}],
-    {ok, CompileVars};
-setup_compile("for_preset") ->
-    CompileVars = [{fruit_list, ["preset-apple", "preset-banana", "preset-coconut"]}],
-    {ok, CompileVars};
-setup_compile("for_records_preset") ->
-    Link1a = [{name, "Amazon (preset)"}, {url, "http://amazon.com"}],
-    Link2a = [{name, "Google (preset)"}, {url, "http://google.com"}],
-    Link3a = [{name, "Microsoft (preset)"}, {url, "http://microsoft.com"}],
-    CompileVars = [{software_links, [Link1a, Link2a, Link3a]}],
-    {ok, CompileVars};
-setup_compile("if_preset") ->
-    CompileVars = [{var1, "something"}],
-    {ok, CompileVars};
-setup_compile("ifequal_preset") ->
-    CompileVars = [{var1, "foo"}, {var2, "foo"}],
-    {ok, CompileVars};
-setup_compile("ifnotequal_preset") ->
-    CompileVars = [{var1, "foo"}, {var2, "foo"}],
-    {ok, CompileVars};
-setup_compile("var_preset") ->
-    CompileVars = [{preset_var1, "preset-var1"}, {preset_var2, "preset-var2"}],
-    {ok, CompileVars};
-setup_compile("extends2") ->
-    File = templates_dir("input/extends2"),
-    Error = {none, erlydtl_beam_compiler, unexpected_extends_tag},
-    {{error, [{File, [Error]}], []}, []};
-setup_compile("extends3") ->
-    File = templates_dir("input/extends3"),
-    Include = templates_dir("input/imaginary"),
-    Error = {none, erlydtl_beam_compiler, {read_file, Include, enoent}},
-    {{error, [{File, [Error]}], []}, []};
-setup_compile("missing") ->
-    File = templates_dir("input/missing"),
-    Error = {none, erlydtl_compiler, {read_file, File, enoent}},
-    {{error, [{File, [Error]}], []}, []};
-setup_compile(_) ->
-    {ok, []}.
-
-%% @spec (Name::string()) -> {CompileStatus::atom(), PresetVars::list(),
-%%     RenderStatus::atom(), RenderVars::list()} | skip
-%% @doc
-%% @end
-%%--------------------------------------------------------------------
-setup("autoescape") ->
-    RenderVars = [{var1, "<b>bold</b>"}],
-    {ok, RenderVars};
-setup("extends") ->
-    RenderVars = [{base_var, "base-barstring"}, {test_var, "test-barstring"}],
-    {ok, RenderVars};
-setup("include_template") -> setup("extends");
-setup("include_path") -> setup("extends");
-setup("extends_path") -> setup("extends");
-setup("extends_path2") -> setup("extends");
-setup("block_super") -> setup("extends");
-setup("filters") ->
-    RenderVars = [
-                  {date_var1, {1975,7,24}},
-                  {datetime_var1, {{1975,7,24}, {7,13,1}}},
-                  {'list', ["eins", "zwei", "drei"]}
-                 ],
-    {ok, RenderVars};
-setup("for") ->
-    RenderVars = [{fruit_list, ["apple", "banana", "coconut"]}],
-    {ok, RenderVars};
-setup("for_list") ->
-    RenderVars = [{fruit_list, [["apple", "apples", "$1"], ["banana", "bananas", "$2"], ["coconut", "coconuts", "$500"]]}],
-    {ok, RenderVars};
-setup("for_tuple") ->
-    RenderVars = [{fruit_list, [{"apple", "apples"}, {"banana", "bananas"}, {"coconut", "coconuts"}]}],
-    {ok, RenderVars};
-setup("for_records") ->
-    Link1 = [{name, "Amazon"}, {url, "http://amazon.com"}],
-    Link2 = [{name, "Google"}, {url, "http://google.com"}],
-    Link3 = [{name, "Microsoft"}, {url, "http://microsoft.com"}],
-    RenderVars = [{link_list, [Link1, Link2, Link3]}],
-    {ok, RenderVars};
-setup("for_records_preset") ->
-    Link1b = [{name, "Canon"}, {url, "http://canon.com"}],
-    Link2b = [{name, "Leica"}, {url, "http://leica.com"}],
-    Link3b = [{name, "Nikon"}, {url, "http://nikon.com"}],
-    RenderVars = [{photo_links, [Link1b, Link2b, Link3b]}],
-    {ok, RenderVars};
-setup("include") ->
-    RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}],
-    {ok, RenderVars};
-setup("if") ->
-    RenderVars = [{var1, "something"}],
-    {ok, RenderVars};
-setup("ifequal") ->
-    RenderVars = [{var1, "foo"}, {var2, "foo"}, {var3, "bar"}],
-    {ok, RenderVars};
-setup("ifequal_preset") ->
-    RenderVars = [{var3, "bar"}],
-    {ok, RenderVars};
-setup("ifnotequal") ->
-    RenderVars = [{var1, "foo"}, {var2, "foo"}, {var3, "bar"}],
-    {ok, RenderVars};
-setup("now") ->
-    {ok, [], [], skip_check};
-setup("var") ->
-    RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}, {var_not_used, "foostring3"}],
-    {ok, RenderVars};
-setup("var_preset") ->
-    RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}],
-    {ok, RenderVars};
-setup("cycle") ->
-    RenderVars = [{test, [integer_to_list(X) || X <- lists:seq(1, 20)]},
-                  {a, "Apple"}, {b, "Banana"}, {c, "Cherry"}],
-    {ok, RenderVars};
-setup("trans") ->
-    RenderVars = [{locale, "reverse"}],
-    {ok, RenderVars};
-setup("locale") ->
-    {ok, _RenderVars = [{locale, "ru"}]};
-setup("custom_tag1") ->
-    {ok, [{a, <<"a1">>}], [{locale, ru}], <<"b1\n">>};
-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\n">>};
-setup("ssi") ->
-    RenderVars = [{path, filename:absname(filename:join(["tests", "input", "ssi_include.html"]))}],
-    {ok, RenderVars};
-%%--------------------------------------------------------------------
-%% Custom tags
-%%--------------------------------------------------------------------
-setup("custom_call") ->
-    RenderVars = [{var1, "something"}],
-    {ok, RenderVars};
-
-setup(_) ->
-    {ok, []}.
-
-
-run_tests() ->
-    io:format("Running functional tests...~n"),
-    file:set_cwd(erlydtl_deps:get_base_dir()),
-    case [filelib:ensure_dir(
-            filename:join([templates_dir(Dir), "foo"]))
-
-          || Dir <- ["output", "expect"]] -- [ok,ok]
-    of
-        [] ->
-            case fold_tests() of
-                {N, []}->
-                    Msg = lists:concat(["All ", N, " functional tests passed~n~n"]),
-                    io:format(Msg),
-                    {ok, Msg};
-                {N, Errs} ->
-                    io:format(
-                      "~b / ~b functional tests failed.~nErrors: ~n",
-                      [length(Errs), N]),
-                    [io:format("  ~s [~s] ~s~n", [Name, Error, Reason])
-                     || {Name, Error, Reason} <- Errs],
-                    throw(failed)
-            end;
-        Err ->
-            [io:format("Ensure dir failed: ~p~n~n", [Reason]) || {error, Reason} <- Err],
-            throw(failed)
-    end.
-
-
-run_test(Name) ->
-    test_compile_render(Name).
-
-
-%%====================================================================
-%% Internal functions
-%%====================================================================
-
-fold_tests() ->
-    lists:foldl(fun(Name, {AccCount, AccErrs}) ->
-                        Res = case catch test_compile_render(Name) of
-                                  ok -> {AccCount + 1, AccErrs};
-                                  {'EXIT', Reason} ->
-                                      io:format("crash"),
-                                      {AccCount + 1, [{Name, crash,
-                                                       io_lib:format("~p", [Reason])}
-                                                      | AccErrs]};
-                                  {Error, Reason} ->
-                                      {AccCount + 1, [{Name, Error, Reason}
-                                                      | AccErrs]}
-                              end,
-                        io:format("~n"), Res
-                end, {0, []}, test_list()).
-
-test_compile_render(Name) ->
-    File = filename:join([templates_docroot(), Name]),
-    Module = "functional_test_" ++ Name,
-    io:format(" Template: ~p, ... ", [Name]),
-    case setup_compile(Name) of
-        {CompileStatus, CompileVars} ->
-            Options = [
-                       {vars, CompileVars},
-                       force_recompile,
-                       return_errors,
-                       return_warnings,
-                       %% debug_info,
-                       {custom_tags_modules, [erlydtl_custom_tags]}],
-            io:format("compiling ... "),
-            case erlydtl:compile(File, Module, Options) of
-                {ok, Mod, [{File, [{none,erlydtl_beam_compiler,no_out_dir}]}]} ->
-                    if CompileStatus =:= ok -> test_render(Name, Mod);
-                       true ->
-                            io:format("missing error"),
-                            {error, "compiling should have failed :" ++ File}
-                    end;
-                {error, _, _}=CompileStatus ->
-                    io:format("ok");
-                Err ->
-                    io:format("failed"),
-                    {compile_error, io_lib:format(
-                                      "~n    Expected: ~p"
-                                      "~n    Actual: ~p~n",
-                                      [CompileStatus, Err])}
-            end;
-        skip -> io:format("skipped")
-    end.
-
-test_render(Name, Module) ->
-    File = filename:join([templates_docroot(), Name]),
-    {RenderStatus, Vars, Opts, RenderResult} =
-        case setup(Name) of
-            {RS, V}       -> {RS, V, [], get_expected_result(Name)};
-            {RS, V, O}    -> {RS, V, O, get_expected_result(Name)};
-            {RS, V, O, R} -> {RS, V, O, R}
-        end,
-    io:format("rendering ... "),
-    case catch Module:render(Vars, Opts) of
-        {ok, Output} ->
-            Data = iolist_to_binary(Output),
-            if RenderStatus =:= ok ->
-                    if RenderResult =:= undefined ->
-                            [with_template_filename(
-                               Dir, Name,
-                               fun(F) -> file:write_file(F, Data) end)
-                             || Dir <- ["output", "expect"]],
-                            io:format("~n    #### NOTE: created new expected output file: \"tests/expect/~s\"."
-                                      "~n    Please verify contents.", [Name]);
-                       RenderResult =:= Data ->
-                            io:format("ok");
-                       RenderResult =:= skip_check ->
-                            io:format("ok (not checked for regression)");
-                       true ->
-                            io:format("failed"),
-                            with_template_filename(
-                              "output", Name,
-                              fun(F) -> file:write_file(F, Data) end),
-                            {error, io_lib:format(
-                                      "Expected output does not match rendered output~n"
-                                      "  ==Expected==~n"
-                                      "~s~n"
-                                      "  --Actual--~n"
-                                      "~s~n"
-                                      "  ==End==~n",
-                                      [RenderResult, Data])}
-                    end;
-               true ->
-                    io:format("missing error"),
-                    {missing_error, "rendering should have failed :" ++ File}
-            end;
-        {'EXIT', Reason} ->
-            io:format("failed"),
-            {render_error, io_lib:format("failed invoking render method of ~p ~p", [Module, Reason])};
-        Err ->
-            if RenderStatus =:= error -> io:format("ok");
-               true -> io:format("failed"),
-                       {render_error, io_lib:format("~p", [Err])}
-            end
-    end.
-
-get_expected_result(Name) ->
-    with_template_filename(
-      "expect", Name,
-      fun(F) ->
-              case filelib:is_regular(F) of
-                  true -> {ok, Data} = file:read_file(F), Data;
-                  false -> undefined
-              end
-      end).
-
-with_template_filename(Dir, Name, Fun) ->
-    FileName = filename:join([templates_dir(Dir), Name]),
-    Fun(FileName).
-
-templates_docroot() -> templates_dir("input").
-templates_dir(Name) -> filename:join(["tests", Name]).

+ 0 - 14
tests/src/erlydtl_lib_test1.erl

@@ -1,14 +0,0 @@
--module(erlydtl_lib_test1).
--behaviour(erlydtl_library).
-
--export([version/0, inventory/1, reverse/1]).
-
-version() -> 1.
-
-inventory(filters) -> [reverse];
-inventory(tags) -> [].
-
-reverse(String) when is_list(String) ->
-    lists:reverse(String);
-reverse(String) when is_binary(String) ->
-    reverse(binary_to_list(String)).

+ 0 - 9
tests/src/erlydtl_lib_testversion.erl

@@ -1,9 +0,0 @@
--module(erlydtl_lib_testversion).
--behaviour(erlydtl_library).
-
--export([version/0, inventory/1]).
-
-version() -> invalid.
-
-inventory(filters) -> [];
-inventory(tags) -> [].

+ 0 - 1656
tests/src/erlydtl_unittests.erl

@@ -1,1656 +0,0 @@
--module(erlydtl_unittests).
-
--export([run_tests/0]).
-
--record(testrec, {foo, bar, baz}).
-
--ifndef(GRP_ERROR_REPORTING_COMPILER_OPTS).
--define(GRP_ERROR_REPORTING_COMPILER_OPTS,[]).
-%%-define(GRP_ERROR_REPORTING_COMPILER_OPTS,[report]).
-%% define GRP_ERROR_REPORTING_COMPILER_OPTS to [report] to print
-%% tested error messages.
--endif.
-
-tests() ->
-    [
-     %% {"scanner",
-     %%  [{"multiline tags", %% weird formatting example from issue #103.
-     %%    <<"{% if a \n"
-     %%      "  %}{% if a.b \n"
-     %%      "    %}{{ a.b \n"
-     %%      "    }}{% endif\n"
-     %%      "  %}{% endif\n"
-     %%      "%}">>,
-     %%    [{a, [{b, 123}]}],
-     %%    <<"...">>} %% dtl compat: expect the whole input text, tags and all..
-     %%  ]},
-     {"vars", [
-               {"string",
-                <<"String value is: {{ var1 }}">>,
-                [{var1, "foo"}], <<"String value is: foo">>},
-               {"int",
-                <<"The magic number is: {{ var1 }}">>,
-                [{var1, 42}], <<"The magic number is: 42">>},
-               {"float",
-                <<"The price of milk is: {{ var1 }}">>,
-                [{var1, 0.42}], <<"The price of milk is: 0.42">>},
-               {"No spaces",
-                <<"{{var1}}">>,
-                [{var1, "foo"}], <<"foo">>},
-               {"Variable name is a tag name",
-                <<"{{ comment }}">>,
-                [{comment, "Nice work!"}], <<"Nice work!">>}
-              ]},
-     {"comment", [
-                  {"comment block is excised",
-                   <<"bob {% comment %}(moron){% endcomment %} loblaw">>,
-                   [], <<"bob  loblaw">>},
-                  {"inline comment is excised",
-                   <<"you're {# not #} a very nice person">>,
-                   [], <<"you're  a very nice person">>}
-                 ]},
-     {"autoescape", [
-                     {"Autoescape works",
-                      <<"{% autoescape on %}{{ var1 }}{% endautoescape %}">>,
-                      [{var1, "<b>bold</b>"}], <<"&lt;b&gt;bold&lt;/b&gt;">>},
-                     {"Nested autoescape",
-                      <<"{% autoescape on %}{{ var1 }}{% autoescape off %}{{ var1 }}{% endautoescape %}{% endautoescape %}">>,
-                      [{var1, "<b>"}], <<"&lt;b&gt;<b>">>}
-                    ]},
-     {"string literal", [
-                         {"Render literal",
-                          <<"{{ \"foo\" }} is my name">>, [], <<"foo is my name">>},
-                         {"Newlines are escaped",
-                          <<"{{ \"foo\\n\" }}">>, [], <<"foo\n">>}
-                        ]},
-     {"cycle", [
-                {"Cycling through quoted strings",
-                 <<"{% for i in test %}{% cycle 'a' 'b' %}{{ i }},{% endfor %}">>,
-                 [{test, ["0", "1", "2", "3", "4"]}], <<"a0,b1,a2,b3,a4,">>},
-                {"Cycling through normal variables",
-                 <<"{% for i in test %}{% cycle aye bee %}{{ i }},{% endfor %}">>,
-                 [{test, ["0", "1", "2", "3", "4"]}, {aye, "a"}, {bee, "b"}],
-                 <<"a0,b1,a2,b3,a4,">>}
-               ]},
-     {"number literal", [
-                         {"Render integer",
-                          <<"{{ 5 }}">>, [], <<"5">>}
-                        ]},
-     {"variable", [
-                   {"Render variable",
-                    <<"{{ var1 }} is my game">>, [{var1, "bar"}], <<"bar is my game">>},
-                   {"Render variable with attribute",
-                    <<"I enjoy {{ var1.game }}">>, [{var1, [{game, "Othello"}]}], <<"I enjoy Othello">>},
-                   {"Render variable with string-key attribute",
-                    <<"I also enjoy {{ var1.game }}">>, [{var1, [{"game", "Parcheesi"}]}], <<"I also enjoy Parcheesi">>},
-                   {"Render variable with binary-key attribute",
-                    <<"I also enjoy {{ var1.game }}">>, [{var1, [{<<"game">>, "Parcheesi"}]}], <<"I also enjoy Parcheesi">>},
-                   {"Render variable in dict",
-                    <<"{{ var1 }}">>, dict:store(var1, "bar", dict:new()), <<"bar">>},
-                   {"Render variable with missing attribute in dict",
-                    <<"{{ var1.foo }}">>, [{var1, dict:store(bar, "Othello", dict:new())}], <<"">>},
-                   {"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",
-                    <<"{{ person.city.state.country }}">>, [{person, [{city, [{state, [{country, "Italy"}]}]}]}],
-                    <<"Italy">>},
-                   {"Index list variable",
-                    <<"{{ var1.2 }}">>, [{var1, [a, b, c]}],
-                    <<"b">>},
-                   {"Index tuple variable",
-                    <<"{{ var1.2 }}">>, [{var1, {a, b, c}}],
-                    <<"b">>}
-                  ]},
-     {"now", [
-              {"now functional",
-               <<"It is the {% now \"jS \\o\\f F Y\" %}.">>, [{var1, ""}], generate_test_date()}
-             ]},
-     {"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",
-              <<"{% if not var1 %}yay{% endif %}">>, [{var1, ""}], <<"yay">>},
-             {"If \"0\"",
-              <<"{% if var1 %}boo{% endif %}">>, [{var1, "0"}], <<>>},
-             {"If 0",
-              <<"{% if var1 %}boo{% endif %}">>, [{var1, 0}], <<>>},
-             {"If false",
-              <<"{% if var1 %}boo{% endif %}">>, [{var1, false}], <<>>},
-             {"If false string",
-              <<"{% if var1 %}boo{% endif %}">>, [{var1, "false"}], <<"boo">>},
-             {"If undefined",
-              <<"{% if var1 %}boo{% endif %}">>, [{var1, undefined}], <<>>},
-             {"If other atom",
-              <<"{% if var1 %}yay{% endif %}">>, [{var1, foobar}], <<"yay">>},
-             {"If non-empty string",
-              <<"{% if var1 %}yay{% endif %}">>, [{var1, "hello"}], <<"yay">>},
-             {"If proplist",
-              <<"{% if var1 %}yay{% endif %}">>, [{var1, [{foo, "bar"}]}], <<"yay">>},
-             {"If complex",
-              <<"{% if foo.bar.baz %}omgwtfbbq{% endif %}">>, [], <<"">>}
-            ]},
-     {"if .. in ..", [
-                      {"If substring in string",
-                       <<"{% if var1 in var2 %}yay{% endif %}">>, [{var1, "rook"}, {var2, "Crooks"}], <<"yay">>},
-                      {"If substring in string (false)",
-                       <<"{% if var1 in var2 %}boo{% endif %}">>, [{var1, "Cook"}, {var2, "Crooks"}], <<>>},
-                      {"If substring not in string",
-                       <<"{% if var1 not in var2 %}yay{% endif %}">>, [{var1, "Cook"}, {var2, "Crooks"}], <<"yay">>},
-                      {"If substring not in string (false)",
-                       <<"{% if var1 not in var2 %}boo{% endif %}">>, [{var1, "rook"}, {var2, "Crooks"}], <<>>},
-                      {"If literal substring in string",
-                       <<"{% if \"man\" in \"Ottoman\" %}yay{% endif %}">>, [], <<"yay">>},
-                      {"If literal substring in string (false)",
-                       <<"{% if \"woman\" in \"Ottoman\" %}boo{% endif %}">>, [], <<>>},
-                      {"If element in list",
-                       <<"{% if var1 in var2 %}yay{% endif %}">>, [{var1, "foo"}, {var2, ["bar", "foo", "baz"]}], <<"yay">>},
-                      {"If element in list (false)",
-                       <<"{% if var1 in var2 %}boo{% endif %}">>, [{var1, "FOO"}, {var2, ["bar", "foo", "baz"]}], <<>>}
-                     ]},
-     {"if .. and ..", [
-                       {"If true and true",
-                        <<"{% if var1 and var2 %}yay{% endif %}">>, [{var1, true}, {var2, true}], <<"yay">>},
-                       {"If true and false",
-                        <<"{% if var1 and var2 %}yay{% endif %}">>, [{var1, true}, {var2, false}], <<"">>},
-                       {"If false and true",
-                        <<"{% if var1 and var2 %}yay{% endif %}">>, [{var1, false}, {var2, true}], <<"">>},
-                       {"If false and false ",
-                        <<"{% if var1 and var2 %}yay{% endif %}">>, [{var1, false}, {var2, false}], <<"">>}
-                      ]},
-     {"if .. or ..", [
-                      {"If true or true",
-                       <<"{% if var1 or var2 %}yay{% endif %}">>, [{var1, true}, {var2, true}], <<"yay">>},
-                      {"If true or false",
-                       <<"{% if var1 or var2 %}yay{% endif %}">>, [{var1, true}, {var2, false}], <<"yay">>},
-                      {"If false or true",
-                       <<"{% if var1 or var2 %}yay{% endif %}">>, [{var1, false}, {var2, true}], <<"yay">>},
-                      {"If false or false ",
-                       <<"{% if var1 or var2 %}yay{% endif %}">>, [{var1, false}, {var2, false}], <<"">>}
-                     ]},
-     {"if equality", [
-                      {"If int equals number literal",
-                       <<"{% if var1 == 2 %}yay{% endif %}">>, [{var1, 2}], <<"yay">>},
-                      {"If int equals number literal (false)",
-                       <<"{% if var1 == 2 %}yay{% endif %}">>, [{var1, 3}], <<"">>},
-                      {"If string equals string literal",
-                       <<"{% if var1 == \"2\" %}yay{% endif %}">>, [{var1, "2"}], <<"yay">>},
-                      {"If string equals string literal (false)",
-                       <<"{% if var1 == \"2\" %}yay{% endif %}">>, [{var1, "3"}], <<"">>},
-                      {"If int not equals number literal",
-                       <<"{% if var1 != 2 %}yay{% endif %}">>, [{var1, 3}], <<"yay">>},
-                      {"If string not equals string literal",
-                       <<"{% if var1 != \"2\" %}yay{% endif %}">>, [{var1, "3"}], <<"yay">>},
-                      {"If filter result equals number literal",
-                       <<"{% if var1|length == 2 %}yay{% endif %}">>, [{var1, ["fo", "bo"]}], <<"yay">>},
-                      {"If filter result equals string literal",
-                       <<"{% if var1|capfirst == \"Foo\" %}yay{% endif %}">>, [{var1, "foo"}], <<"yay">>}
-                     ]},
-     {"if size comparison", [
-                             {"If int greater than number literal",
-                              <<"{% if var1 > 2 %}yay{% endif %}">>, [{var1, 3}], <<"yay">>},
-                             {"If int greater than negative number literal",
-                              <<"{% if var1 > -2 %}yay{% endif %}">>, [{var1, -1}], <<"yay">>},
-                             {"If int greater than number literal (false)",
-                              <<"{% if var1 > 2 %}yay{% endif %}">>, [{var1, 2}], <<"">>},
-
-                             {"If int greater than or equal to number literal",
-                              <<"{% if var1 >= 2 %}yay{% endif %}">>, [{var1, 3}], <<"yay">>},
-                             {"If int greater than or equal to number literal (2)",
-                              <<"{% if var1 >= 2 %}yay{% endif %}">>, [{var1, 2}], <<"yay">>},
-                             {"If int greater than or equal to number literal (false)",
-                              <<"{% if var1 >= 2 %}yay{% endif %}">>, [{var1, 1}], <<"">>},
-
-                             {"If int less than number literal",
-                              <<"{% if var1 < 2 %}yay{% endif %}">>, [{var1, 1}], <<"yay">>},
-                             {"If int less than number literal (false)",
-                              <<"{% if var1 < 2 %}yay{% endif %}">>, [{var1, 2}], <<"">>},
-
-                             {"If int less than or equal to number literal",
-                              <<"{% if var1 <= 2 %}yay{% endif %}">>, [{var1, 1}], <<"yay">>},
-                             {"If int less than or equal to number literal",
-                              <<"{% if var1 <= 2 %}yay{% endif %}">>, [{var1, 2}], <<"yay">>},
-                             {"If int less than or equal to number literal (false)",
-                              <<"{% if var1 <= 2 %}yay{% endif %}">>, [{var1, 3}], <<"">>}
-                            ]},
-     {"if complex bool", [
-                          {"If (true or false) and true",
-                           <<"{% if (var1 or var2) and var3 %}yay{% endif %}">>,
-                           [{var1, true}, {var2, false}, {var3, true}], <<"yay">>},
-                          {"If true or (false and true)",
-                           <<"{% if var1 or (var2 and var3) %}yay{% endif %}">>,
-                           [{var1, true}, {var2, false}, {var3, true}], <<"yay">>}
-                         ]},
-     {"for", [
-              {"Simple loop",
-               <<"{% for x in list %}{{ x }}{% endfor %}">>, [{'list', ["1", "2", "3"]}],
-               <<"123">>},
-              {"Reversed loop",
-               <<"{% for x in list reversed %}{{ x }}{% endfor %}">>, [{'list', ["1", "2", "3"]}],
-               <<"321">>},
-              {"Expand list",
-               <<"{% for x, y in list %}{{ x }},{{ y }}\n{% endfor %}">>, [{'list', [["X", "1"], ["X", "2"]]}],
-               <<"X,1\nX,2\n">>},
-              {"Expand tuple",
-               <<"{% for x, y in list %}{{ x }},{{ y }}\n{% endfor %}">>, [{'list', [{"X", "1"}, {"X", "2"}]}],
-               <<"X,1\nX,2\n">>},
-              {"Resolve variable attribute",
-               <<"{% for number in person.numbers %}{{ number }}\n{% endfor %}">>, [{person, [{numbers, ["411", "911"]}]}],
-               <<"411\n911\n">>},
-              {"Resolve nested variable attribute",
-               <<"{% for number in person.home.numbers %}{{ number }}\n{% endfor %}">>, [{person, [{home, [{numbers, ["411", "911"]}]}]}],
-               <<"411\n911\n">>},
-              {"Counter0",
-               <<"{% for number in numbers %}{{ forloop.counter0 }}. {{ number }}\n{% endfor %}">>,
-               [{numbers, ["Zero", "One", "Two"]}], <<"0. Zero\n1. One\n2. Two\n">>},
-              {"Counter",
-               <<"{% for number in numbers %}{{ forloop.counter }}. {{ number }}\n{% endfor %}">>,
-               [{numbers, ["One", "Two", "Three"]}], <<"1. One\n2. Two\n3. Three\n">>},
-              {"Reverse Counter0",
-               <<"{% for number in numbers %}{{ forloop.revcounter0 }}. {{ number }}\n{% endfor %}">>,
-               [{numbers, ["Two", "One", "Zero"]}], <<"2. Two\n1. One\n0. Zero\n">>},
-              {"Reverse Counter",
-               <<"{% for number in numbers %}{{ forloop.revcounter }}. {{ number }}\n{% endfor %}">>,
-               [{numbers, ["Three", "Two", "One"]}], <<"3. Three\n2. Two\n1. One\n">>},
-              {"Counter \"first\"",
-               <<"{% for number in numbers %}{% if forloop.first %}{{ number }}{% endif %}{% endfor %}">>,
-               [{numbers, ["One", "Two", "Three"]}], <<"One">>},
-              {"Counter \"last\"",
-               <<"{% for number in numbers %}{% if forloop.last %}{{ number }}{% endif %}{% endfor %}">>,
-               [{numbers, ["One", "Two", "Three"]}], <<"Three">>},
-              {"Nested for loop",
-               <<"{% for outer in list %}{% for inner in outer %}{{ inner }}\n{% endfor %}{% endfor %}">>,
-               [{'list', [["Al", "Albert"], ["Jo", "Joseph"]]}],
-               <<"Al\nAlbert\nJo\nJoseph\n">>},
-              {"Access parent loop counters",
-               <<"{% for outer in list %}{% for inner in outer %}({{ forloop.parentloop.counter0 }}, {{ forloop.counter0 }})\n{% endfor %}{% endfor %}">>,
-               [{'list', [["One", "two"], ["One", "two"]]}], [], [], <<"(0, 0)\n(0, 1)\n(1, 0)\n(1, 1)\n">>,
-               %% the warnings we get from the erlang compiler still needs some care..
-               [error_info([{0, erl_lint, {unused_var, 'Var_inner/3_1:31'}}, no_out_dir])]},
-              {"If changed",
-               <<"{% for x in list %}{% ifchanged %}{{ x }}\n{% endifchanged %}{% endfor %}">>,
-               [{'list', ["one", "two", "two", "three", "three", "three"]}], <<"one\ntwo\nthree\n">>},
-              {"If changed/2",
-               <<"{% for x, y in list %}{% ifchanged %}{{ x|upper }}{% endifchanged %}{% ifchanged %}{{ y|lower }}{% endifchanged %}\n{% endfor %}">>,
-               [{'list', [["one", "a"], ["two", "A"], ["two", "B"], ["three", "b"], ["three", "c"], ["Three", "b"]]}], <<"ONEa\nTWO\nb\nTHREE\nc\nb\n">>},
-              {"If changed/else",
-               <<"{% for x in list %}{% ifchanged %}{{ x }}\n{% else %}foo\n{% endifchanged %}{% endfor %}">>,
-               [{'list', ["one", "two", "two", "three", "three", "three"]}], <<"one\ntwo\nfoo\nthree\nfoo\nfoo\n">>},
-              {"If changed/param",
-               <<"{% for date in list %}{% ifchanged date.month %} {{ date.month }}:{{ date.day }}{% else %},{{ date.day }}{% endifchanged %}{% endfor %}\n">>,
-               [{'list', [[{month,"Jan"},{day,1}],[{month,"Jan"},{day,2}],[{month,"Apr"},{day,10}],
-                          [{month,"Apr"},{day,11}],[{month,"May"},{day,4}]]}],
-               <<" Jan:1,2 Apr:10,11 May:4\n">>},
-              {"If changed/param2",
-               <<"{% for x, y in list %}{% ifchanged y|upper %}{{ x|upper }}{% endifchanged %}\n{% endfor %}">>,
-               [{'list', [["one", "a"], ["two", "A"], ["two", "B"], ["three", "b"], ["three", "c"], ["Three", "b"]]}], <<"ONE\n\nTWO\n\nTHREE\nTHREE\n">>},
-              {"If changed/param2 combined",
-               <<"{% for x, y in list %}{% ifchanged x y|upper %}{{ x }}{% endifchanged %}\n{% endfor %}">>,
-               [{'list', [["one", "a"], ["two", "A"], ["two", "B"], ["three", "b"], ["three", "B"], ["three", "c"]]}], <<"one\ntwo\ntwo\nthree\n\nthree\n">>},
-              {"If changed/resolve",
-               <<"{% for x in list %}{% ifchanged x.name|first %}{{ x.value }}{% endifchanged %}\n{% endfor %}">>,
-               [{'list', [[{"name", ["nA","nB"]},{"value","1"}],[{"name", ["nA","nC"]},{"value","2"}],
-                          [{"name", ["nB","nC"]},{"value","3"}],[{"name", ["nB","nA"]},{"value","4"}]]}],
-               <<"1\n\n3\n\n">>},
-
-              {"Loop undefined var",
-               <<"{% for i in undef %}i = {{ i }}.\n{% endfor %}">>,
-               [],
-               <<"">>},
-              {"Loop filtered value rather than variable",
-               <<"{% for x in 123|make_list %}{% if not forloop.first %}, {% endif %}{{ x }}{% endfor %}">>,
-               [],
-               <<"1, 2, 3">>}
-             ]},
-     {"for/empty", [
-                    {"Simple loop",
-                     <<"{% for x in list %}{{ x }}{% empty %}shucks{% endfor %}">>, [{'list', ["1", "2", "3"]}],
-                     <<"123">>},
-                    {"Simple loop (empty)",
-                     <<"{% for x in list %}{{ x }}{% empty %}shucks{% endfor %}">>, [{'list', []}],
-                     <<"shucks">>}
-                   ]},
-     {"ifequal", [
-                  {"Compare variable to literal",
-                   <<"{% ifequal var1 \"foo\" %}yay{% endifequal %}">>,
-                   [{var1, "foo"}], <<"yay">>},
-                  {"Compare variable to unequal literal",
-                   <<"{% ifequal var1 \"foo\" %}boo{% endifequal %}">>,
-                   [{var1, "bar"}], <<>>},
-                  {"Compare literal to variable",
-                   <<"{% ifequal \"foo\" var1 %}yay{% endifequal %}">>,
-                   [{var1, "foo"}], <<"yay">>},
-                  {"Compare literal to unequal variable",
-                   <<"{% ifequal \"foo\" var1 %}boo{% endifequal %}">>,
-                   [{var1, "bar"}], <<>>},
-                  {"Compare variable to literal (int string)",
-                   <<"{% ifequal var1 \"2\" %}yay{% else %}boo{% endifequal %}">>,
-                   [{var1, "2"}], <<"yay">>},
-                  {"Compare variable to literal (int)",
-                   <<"{% ifequal var1 2 %}yay{% else %}boo{% endifequal %}">>,
-                   [{var1, 2}], <<"yay">>},
-                  {"Compare variable to unequal literal (int)",
-                   <<"{% ifequal var1 2 %}boo{% else %}yay{% endifequal %}">>,
-                   [{var1, 3}], <<"yay">>},
-                  {"Compare variable to equal literal (atom)",
-                   <<"{% ifequal var1 \"foo\"%}yay{% endifequal %}">>,
-                   [{var1, foo}], <<"yay">>},
-                  {"Compare variable to unequal literal (atom)",
-                   <<"{% ifequal var1 \"foo\"%}yay{% else %}boo{% endifequal %}">>,
-                   [{var1, bar}], <<"boo">>}
-                 ]},
-     {"ifequal/else", [
-                       {"Compare variable to literal",
-                        <<"{% ifequal var1 \"foo\" %}yay{% else %}boo{% endifequal %}">>,
-                        [{var1, "foo"}], <<"yay">>},
-                       {"Compare variable to unequal literal",
-                        <<"{% ifequal var1 \"foo\" %}boo{% else %}yay{% endifequal %}">>,
-                        [{var1, "bar"}], <<"yay">>},
-                       {"Compare literal to variable",
-                        <<"{% ifequal \"foo\" var1 %}yay{% else %}boo{% endifequal %}">>,
-                        [{var1, "foo"}], <<"yay">>},
-                       {"Compare literal to unequal variable",
-                        <<"{% ifequal \"foo\" var1 %}boo{% else %}yay{% endifequal %}">>,
-                        [{var1, "bar"}], <<"yay">>}
-                      ]},
-     {"ifnotequal", [
-                     {"Compare variable to literal",
-                      <<"{% ifnotequal var1 \"foo\" %}boo{% endifnotequal %}">>,
-                      [{var1, "foo"}], <<>>},
-                     {"Compare variable to unequal literal",
-                      <<"{% ifnotequal var1 \"foo\" %}yay{% endifnotequal %}">>,
-                      [{var1, "bar"}], <<"yay">>},
-                     {"Compare literal to variable",
-                      <<"{% ifnotequal \"foo\" var1 %}boo{% endifnotequal %}">>,
-                      [{var1, "foo"}], <<>>},
-                     {"Compare literal to unequal variable",
-                      <<"{% ifnotequal \"foo\" var1 %}yay{% endifnotequal %}">>,
-                      [{var1, "bar"}], <<"yay">>}
-                    ]},
-     {"ifnotequal/else", [
-                          {"Compare variable to literal",
-                           <<"{% ifnotequal var1 \"foo\" %}boo{% else %}yay{% endifnotequal %}">>,
-                           [{var1, "foo"}], <<"yay">>},
-                          {"Compare variable to unequal literal",
-                           <<"{% ifnotequal var1 \"foo\" %}yay{% else %}boo{% endifnotequal %}">>,
-                           [{var1, "bar"}], <<"yay">>},
-                          {"Compare literal to variable",
-                           <<"{% ifnotequal \"foo\" var1 %}boo{% else %}yay{% endifnotequal %}">>,
-                           [{var1, "foo"}], <<"yay">>},
-                          {"Compare literal to unequal variable",
-                           <<"{% ifnotequal \"foo\" var1 %}yay{% else %}boo{% endifnotequal %}">>,
-                           [{var1, "bar"}], <<"yay">>}
-                         ]},
-     {"filter tag", [
-                     {"Apply a filter",
-                      <<"{% filter escape %}&{% endfilter %}">>, [], <<"&amp;">>},
-                     {"Chained filters",
-                      <<"{% filter linebreaksbr|escape %}\n{% endfilter %}">>, [], <<"&lt;br /&gt;">>}
-                    ]},
-     {"filters", [
-                  {"Filter a literal",
-                   <<"{{ \"pop\"|capfirst }}">>, [],
-                   <<"Pop">>},
-                  {"Filters applied in order",
-                   <<"{{ var1|force_escape|length }}">>, [{var1, <<"&">>}],
-                   <<"5">>},
-                  {"Escape is applied last",
-                   <<"{{ var1|escape|linebreaksbr }}">>, [{var1, <<"\n">>}],
-                   <<"&lt;br /&gt;">>},
-                  {"add; lhs number, rhs number",
-                   <<"{{ one|add:4}}">>, [{one, 1}],
-                   <<"5">>},
-                  {"add; lhs numeric string, rhs number",
-                   <<"{{ one|add:4}}">>, [{one, "1"}],
-                   <<"5">>},
-                  {"add; lhs number, rhs numeric string",
-                   <<"{{ one|add:'4'}}">>, [{one, 1}],
-                   <<"5">>},
-                  {"add; lhs non-numeric string, rhs number",
-                   <<"{{ one|add:4}}">>, [{one, "foo"}],
-                   <<"foo4">>},
-                  {"add; lhs number, rhs non-numeric string",
-                   <<"{{ one|add:'foo'}}">>, [{one, 1}],
-                   <<"1foo">>},
-                  {"add; lhs non-numeric string, rhs non-numeric string",
-                   <<"{{ one|add:'bar'}}">>, [{one, "foo"}],
-                   <<"foobar">>},
-                  {"add; lhs numeric string, rhs numeric string",
-                   <<"{{ one|add:'4'}}">>, [{one, "1"}],
-                   <<"5">>},
-                  {"|addslashes",
-                   <<"{{ var1|addslashes }}">>, [{var1, "Jimmy's \"great\" meats'n'things"}],
-                   <<"Jimmy\\'s \\\"great\\\" meats\\'n\\'things">>},
-                  {"|capfirst",
-                   <<"{{ var1|capfirst }}">>, [{var1, "dana boyd"}],
-                   <<"Dana boyd">>},
-                  {"|center:10",
-                   <<"{{ var1|center:10 }}">>, [{var1, "MB"}],
-                   <<"    MB    ">>},
-                  {"|center:1",
-                   <<"{{ var1|center:1 }}">>, [{var1, "KBR"}],
-                   <<"B">>},
-                  {"|cut:\" \"",
-                   <<"{{ var1|cut:\" \" }}">>, [{var1, "String with spaces"}],
-                   <<"Stringwithspaces">>},
-                  {"|date 1",
-                   <<"{{ var1|date:\"jS F Y H:i\" }}">>,
-                   [{var1, {1975,7,24}}],
-                   <<"24th July 1975 00:00">>},
-                  {"|date 2",
-                   <<"{{ var1|date:\"jS F Y H:i\" }}">>,
-                   [{var1, {{1975,7,24}, {7,13,1}}}],
-                   <<"24th July 1975 07:13">>},
-                  {"|date 3",
-                   <<"{{ var1|date }}">>,
-                   [{var1, {{1975,7,24}, {7,13,1}}}],
-                   <<"July 24, 1975">>},
-                  {"|default:\"foo\" 1",
-                   <<"{{ var1|default:\"foo\" }}">>, [], <<"foo">>},
-                  {"|default:\"foo\" 2",
-                   <<"{{ var1|default:\"foo\" }}">>, [{var1, "bar"}], <<"bar">>},
-                  {"|default:\"foo\" 3",
-                   <<"{{ var1|default:\"foo\" }}">>, [{var1, "0"}], <<"foo">>},
-                  {"|default_if_none:\"foo\"",
-                   <<"{{ var1|default_if_none:\"foo\" }}">>, [], <<"foo">>},
-                  {"|default_if_none:\"foo\" 2",
-                   <<"{{ var1|default_if_none:\"foo\" }}">>, [{var1, "bar"}], <<"bar">>},
-                  {"|dictsort 1",
-                   <<"{{ var1|dictsort:\"foo\" }}">>,
-                   [{var1,[[{foo,2}],[{foo,1}]]}], <<"{foo,1}{foo,2}">>},
-                  {"|dictsort 2",
-                   <<"{{ var1|dictsort:\"foo.bar\" }}">>,
-                   [{var1,[[{foo,[{bar,2}]}],[{foo,[{bar,1}]}]]}],
-                   <<"{foo,[{bar,1}]}{foo,[{bar,2}]}">>},
-                  {"|divisibleby:\"3\"",
-                   <<"{% if var1|divisibleby:\"3\" %}yay{% endif %}">>, [{var1, 21}], <<"yay">>},
-                  {"|divisibleby:\"3\"",
-                   <<"{% if var1|divisibleby:\"3\" %}yay{% endif %}">>, [{var1, 22}], <<"">>},
-                  {"|escape",
-                   <<"{% autoescape on %}{{ var1|escape|escape|escape }}{% endautoescape %}">>, [{var1, ">&1"}], <<"&gt;&amp;1">>},
-                  {"|escapejs",
-                   <<"{{ var1|escapejs }}">>, [{var1, "testing\r\njavascript 'string\" <b>escaping</b>"}],
-                   <<"testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u003Cb\\u003Eescaping\\u003C/b\\u003E">>},
-                  {"|filesizeformat (bytes)",
-                   <<"{{ var1|filesizeformat }}">>, [{var1, 1023}], <<"1023 bytes">>},
-                  {"|filesizeformat (KB)",
-                   <<"{{ var1|filesizeformat }}">>, [{var1, 3487}], <<"3.4 KB">>},
-                  {"|filesizeformat (MB)",
-                   <<"{{ var1|filesizeformat }}">>, [{var1, 6277098}], <<"6.0 MB">>},
-                  {"|filesizeformat (GB)",
-                   <<"{{ var1|filesizeformat }}">>, [{var1, 1024 * 1024 * 1024}], <<"1.0 GB">>},
-                  {"|first",
-                   <<"{{ var1|first }}">>, [{var1, "James"}],
-                   <<"J">>},
-                  {"|fix_ampersands",
-                   <<"{{ var1|fix_ampersands }}">>, [{var1, "Ben & Jerry's"}],
-                   <<"Ben &amp; Jerry's">>},
-
-                  {"|floatformat:\"-1\"",
-                   <<"{{ var1|floatformat:\"-1\" }}">>, [{var1, 34.23234}],
-                   <<"34.2">>},
-                  {"int |floatformat",
-                   <<"{{ var1|floatformat:\"-1\" }}">>, [{var1, 123}],
-                   <<"123">>},
-                  {"string |floatformat",
-                   <<"{{ var1|floatformat:\"-1\" }}">>, [{var1, "123.321"}],
-                   <<"123.3">>},
-                  {"binary |floatformat",
-                   <<"{{ var1|floatformat:\"-1\" }}">>, [{var1, <<"123.321">>}],
-                   <<"123.3">>},
-
-                  %% from: https://docs.djangoproject.com/en/1.6/ref/templates/builtins/#floatformat
-                  {"1.a) |floatformat",
-                   <<"{{ var1|floatformat }}">>, [{var1, 34.23234}],
-                   <<"34.2">>},
-                  {"1.b) |floatformat",
-                   <<"{{ var1|floatformat }}">>, [{var1, 34.00000}],
-                   <<"34">>},
-                  {"1.c) |floatformat",
-                   <<"{{ var1|floatformat }}">>, [{var1, 34.26000}],
-                   <<"34.3">>},
-                  {"2.a) |floatformat:\"3\"",
-                   <<"{{ var1|floatformat:\"3\" }}">>, [{var1, 34.23234}],
-                   <<"34.232">>},
-                  {"2.b) |floatformat:\"3\"",
-                   <<"{{ var1|floatformat:\"3\" }}">>, [{var1, 34.00000}],
-                   <<"34.000">>},
-                  {"2.c) |floatformat:\"3\"",
-                   <<"{{ var1|floatformat:\"3\" }}">>, [{var1, 34.26000}],
-                   <<"34.260">>},
-                  {"3.a) |floatformat:\"0\"",
-                   <<"{{ var1|floatformat:\"0\" }}">>, [{var1, 34.23234}],
-                   <<"34">>},
-                  {"3.b) |floatformat:\"0\"",
-                   <<"{{ var1|floatformat:\"0\" }}">>, [{var1, 34.00000}],
-                   <<"34">>},
-                  {"3.c) |floatformat:\"0\"",
-                   <<"{{ var1|floatformat:\"0\" }}">>, [{var1, 39.56000}],
-                   <<"40">>},
-                  {"4.a) |floatformat:\"-3\"",
-                   <<"{{ var1|floatformat:\"-3\" }}">>, [{var1, 34.23234}],
-                   <<"34.232">>},
-                  {"4.b) |floatformat:\"-3\"",
-                   <<"{{ var1|floatformat:\"-3\" }}">>, [{var1, 34.00000}],
-                   <<"34">>},
-                  {"4.c) |floatformat:\"-3\"",
-                   <<"{{ var1|floatformat:\"-3\" }}">>, [{var1, 34.26000}],
-                   <<"34.260">>},
-
-                  {"|force_escape",
-                   <<"{{ var1|force_escape }}">>, [{var1, "Ben & Jerry's <=> \"The World's Best Ice Cream\""}],
-                   <<"Ben &amp; Jerry&#039;s &lt;=&gt; &quot;The World&#039;s Best Ice Cream&quot;">>},
-                  {"iolist |force_escape",
-                   <<"{{ var1|force_escape }}">>, [{var1, ["'a'"]}],
-                   <<"&#039;a&#039;">>},
-                  {"nested iolist |force_escape",
-                   <<"{{ var1|force_escape }}">>, [{var1, ["a'", <<"b">>, [<<"<c">>, "d", ["e>"]]]}],
-                   <<"a&#039;b&lt;cde&gt;">>},
-                  {"|format_integer",
-                   <<"{{ var1|format_integer }}">>, [{var1, 28}], <<"28">>},
-                  {"|format_number 1",
-                   <<"{{ var1|format_number }}">>, [{var1, 28}], <<"28">>},
-                  {"|format_number 2",
-                   <<"{{ var1|format_number }}">>, [{var1, 23.77}], <<"23.77">>},
-                  {"|format_number 3",
-                   <<"{{ var1|format_number }}">>, [{var1, "28.77"}], <<"28.77">>},
-                  {"|format_number 4",
-                   <<"{{ var1|format_number }}">>, [{var1, "23.77"}], <<"23.77">>},
-                  {"|format_number 5",
-                   <<"{{ var1|format_number }}">>, [{var1, fun() -> 29 end}], <<"29">>},
-                  {"|format_number 6",
-                   <<"{{ var1|format_number }}">>, [{var1, fun() -> fun() -> 31 end end}], <<"31">>},
-                  {"|get_digit:\"2\"",
-                   <<"{{ var1|get_digit:\"2\" }}">>, [{var1, 42}], <<"4">>},
-                  {"|iriencode",
-                   <<"{{ url|iriencode }}">>, [{url, "You #$*@!!"}], <<"You+#$*@!!">>},
-                  {"|join:\", \" (list)",
-                   <<"{{ var1|join:\", \" }}">>, [{var1, ["Liberte", "Egalite", "Fraternite"]}],
-                   <<"Liberte, Egalite, Fraternite">>},
-                  {"|join:\", \" (binary)",
-                   <<"{{ var1|join:\", \" }}">>, [{var1, [<<"Liberte">>, "Egalite", <<"Fraternite">>]}],
-                   <<"Liberte, Egalite, Fraternite">>},
-                  {"|last",
-                   <<"{{ var1|last }}">>, [{var1, "XYZ"}],
-                   <<"Z">>},
-                  {"|length",
-                   <<"{{ var1|length }}">>, [{var1, "antidisestablishmentarianism"}],
-                   <<"28">>},
-                  {"|linebreaks",
-                   <<"{{ var1|linebreaks }}">>, [{var1, "Joel\nis a slug"}],
-                   <<"<p>Joel<br />is a slug</p>">>},
-                  {"|linebreaks",
-                   <<"{{ var1|linebreaks }}">>, [{var1, "Joel\n\n\n\nis a slug"}],
-                   <<"<p>Joel</p><p>is a slug</p>">>},
-                  {"|linebreaks",
-                   <<"{{ var1|linebreaks }}">>, [{var1, "Joel\n\nis a \nslug"}],
-                   <<"<p>Joel</p><p>is a <br />slug</p>">>},
-                  {"|linebreaksbr",
-                   <<"{{ var1|linebreaksbr }}">>, [{var1, "One\nTwo\n\nThree\n\n\n"}],
-                   <<"One<br />Two<br /><br />Three<br /><br /><br />">>},
-                  {"|linebreaksbr",
-                   <<"{{ \"One\\nTwo\\n\\nThree\\n\\n\\n\"|linebreaksbr }}">>, [],
-                   <<"One<br />Two<br /><br />Three<br /><br /><br />">>},
-                  {"|linenumbers",
-                   <<"{{ var1|linenumbers }}">>, [{var1, "a\nb\nc"}],
-                   <<"1. a\n2. b\n3. c">>},
-                  {"|linenumbers",
-                   <<"{{ var1|linenumbers }}">>, [{var1, "a"}],
-                   <<"1. a">>},
-                  {"|linenumbers",
-                   <<"{{ var1|linenumbers }}">>, [{var1, "a\n"}],
-                   <<"1. a\n2. ">>},
-                  {"|ljust:10",
-                   <<"{{ var1|ljust:10 }}">>, [{var1, "Gore"}],
-                   <<"Gore      ">>},
-                  {"|lower",
-                   <<"{{ var1|lower }}">>, [{var1, "E. E. Cummings"}],
-                   <<"e. e. cummings">>},
-                  {"|makelist",
-                   <<"{{ list|make_list }}">>, [{list, "Joel"}],
-                   <<"J","o","e","l">>},
-                  {"|pluralize",
-                   <<"{{ num|pluralize }}">>, [{num, 1}],
-                   <<"">>},
-                  {"|pluralize",
-                   <<"{{ num|pluralize }}">>, [{num, 2}],
-                   <<"s">>},
-                  {"|pluralize:\"s\"",
-                   <<"{{ num|pluralize }}">>, [{num, 1}],
-                   <<"">>},
-                  {"|pluralize:\"s\"",
-                   <<"{{ num|pluralize }}">>, [{num, 2}],
-                   <<"s">>},
-                  {"|pluralize:\"y,es\" (list)",
-                   <<"{{ num|pluralize:\"y,es\" }}">>, [{num, 1}],
-                   <<"y">>},
-                  {"|pluralize:\"y,es\" (list)",
-                   <<"{{ num|pluralize:\"y,es\" }}">>, [{num, 2}],
-                   <<"es">>},
-                  {"|random",
-                   <<"{{ var1|random }}">>, [{var1, ["foo", "foo", "foo"]}],
-                   <<"foo">>},
-                  {"|removetags:\"b span\"",
-                   <<"{{ var1|removetags:\"b span\" }}">>, [{var1, "<B>Joel</B> <button>is</button> a <span>slug</span>"}],
-                   <<"<B>Joel</B> <button>is</button> a slug">>},
-                  {"|rjust:10",
-                   <<"{{ var1|rjust:10 }}">>, [{var1, "Bush"}],
-                   <<"      Bush">>},
-                  {"|safe",
-                   <<"{% autoescape on %}{{ var1|safe|escape }}{% endautoescape %}">>, [{var1, "&"}],
-                   <<"&">>},
-                  %%python/django slice is zero based, erlang lists are 1 based
-                  %%first number included, second number not
-                  %%negative numbers are allowed
-                  %%regex to convert from erlydtl_filters_tests:
-                                                % for slice: \?assert.*\( \[(.*)\], erlydtl_filters:(.*)\((.*),"(.*)"\)\),
-                                                % {"|slice:\"$4\"", <<"{{ var|$2:\"$4\" }}">>, [{var, $3}],<<$1>>},
-                                                % \t\t{"|slice:\"$4\"",\n\t\t\t\t\t <<"{{ var|$2:\"$4\" }}">>, [{var, $3}],\n\t\t\t\t\t<<$1>>},
-                                                %
-                                                % for stringformat:
-                                                % \?assert.*\( (.*), erlydtl_filters:(.*)\((.*), "(.*)"\) \)
-                                                % \t\t{"|stringformat:\"$4\"",\n\t\t\t\t\t <<"{{ var|$2:\"$4\" }}">>, [{var, $3}],\n\t\t\t\t\t<<$1>>}
-
-                  {"|slice:\":\"",
-                   <<"{{ var|slice:\":\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-                  {"|slice:\"1\"",
-                   <<"{{ var|slice:\"1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<"2">>},
-                  {"|slice:\"100\"",
-                   <<"{{ var|slice:\"100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<"indexError">>},
-                  {"|slice:\"-1\"",
-                   <<"{{ var|slice:\"-1\" }}">>, [{var, ["a","b","c","d","e","f","g","h","i"]}],
-                   <<"i">>},
-                  {"|slice:\"-1\"",
-                   <<"{{ var|slice:\"-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<"9">>},
-                  {"|slice:\"-100\"",
-                   <<"{{ var|slice:\"-100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<"indexError">>},
-                  {"|slice:\"1:\"",
-                   <<"{{ var|slice:\"1:\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<2,3,4,5,6,7,8,9>>},
-                  {"|slice:\"100:\"",
-                   <<"{{ var|slice:\"100:\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"-1:\"",
-                   <<"{{ var|slice:\"-1:\" }}">>, [{var, ["a","b","c","d","e","f","h","i","j"]}],
-                   <<"j">>},
-                  {"|slice:\"-1:\"",
-                   <<"{{ var|slice:\"-1:\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<9>>},
-                  {"|slice:\"-100:\"",
-                   <<"{{ var|slice:\"-100:\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-
-                  {"|slice:\":1\"",
-                   <<"{{ var|slice:\":1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1>>},
-                  {"|slice:\":100\"",
-                   <<"{{ var|slice:\":100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-                  {"|slice:\":-1\"",
-                   <<"{{ var|slice:\":-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8>>},
-                  {"|slice:\":-100\"",
-                   <<"{{ var|slice:\":-100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-
-                  {"|slice:\"-1:-1\"",
-                   <<"{{ var|slice:\"-1:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"1:1\"",
-                   <<"{{ var|slice:\"1:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"1:-1\"",
-                   <<"{{ var|slice:\"1:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<2,3,4,5,6,7,8>>},
-                  {"|slice:\"-1:1\"",
-                   <<"{{ var|slice:\"-1:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-
-                  {"|slice:\"-100:-100\"",
-                   <<"{{ var|slice:\"-100:-100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"100:100\"",
-                   <<"{{ var|slice:\"100:100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"100:-100\"",
-                   <<"{{ var|slice:\"100:-100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"-100:100\"",
-                   <<"{{ var|slice:\"-100:100\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-
-
-                  {"|slice:\"1:3\"",
-                   <<"{{ var|slice:\"1:3\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<2,3>>},
-
-                  {"|slice:\"::\"",
-                   <<"{{ var|slice:\"::\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-                  {"|slice:\"1:9:1\"",
-                   <<"{{ var|slice:\"1:9:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<2,3,4,5,6,7,8,9>>},
-                  {"|slice:\"10:1:-1\"",
-                   <<"{{ var|slice:\"10:1:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<9,8,7,6,5,4,3>>},
-                  {"|slice:\"-111:-1:1\"",
-                   <<"{{ var|slice:\"-111:-1:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8>>},
-
-                  {"|slice:\"-111:-111:1\"",
-                   <<"{{ var|slice:\"-111:-111:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"111:111:1\"",
-                   <<"{{ var|slice:\"111:111:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"-111:111:1\"",
-                   <<"{{ var|slice:\"-111:111:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<1,2,3,4,5,6,7,8,9>>},
-                  {"|slice:\"111:-111:1\"",
-                   <<"{{ var|slice:\"111:-111:1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-
-                  {"|slice:\"-111:-111:-1\"",
-                   <<"{{ var|slice:\"-111:-111:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"111:111:-1\"",
-                   <<"{{ var|slice:\"111:111:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"-111:111:-1\"",
-                   <<"{{ var|slice:\"-111:111:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<>>},
-                  {"|slice:\"111:-111:-1\"",
-                   <<"{{ var|slice:\"111:-111:-1\" }}">>, [{var, [1,2,3,4,5,6,7,8,9]}],
-                   <<9,8,7,6,5,4,3,2,1>>},              {"|phone2numeric",
-                                                         <<"{{ var1|phone2numeric }}">>, [{var1, "1-800-COLLECT"}],
-                                                         <<"1-800-2655328">>},
-                  {"|slugify",
-                   <<"{{ var1|slugify }}">>, [{var1, "What The $#_! Was He Thinking?"}],
-                   <<"what-the-_-was-he-thinking">>},
-                  {"|slice:\"s\"",
-                   <<"{{ var|stringformat:\"s\" }}">>, [{var, "test"}],
-                   <<"test">>},
-                  {"|stringformat:\"s\"",
-                   <<"{{ var|stringformat:\"s\" }}">>, [{var, "test"}],
-                   <<"test">>},
-                  {"|stringformat:\"s\"",
-                   <<"{{ var|stringformat:\"s\" }}">>, [{var, "1"}],
-                   <<"1">>},
-                  {"|stringformat:\"s\"",
-                   <<"{{ var|stringformat:\"s\" }}">>, [{var, "test"}],
-                   <<"test">>},
-                  {"|stringformat:\"10s\"",
-                   <<"{{ var|stringformat:\"10s\" }}">>, [{var, "test"}],
-                   <<"      test">>},
-                  {"|stringformat:\"-10s\"",
-                   <<"{{ var|stringformat:\"-10s\" }}">>, [{var, "test"}],
-                   <<"test      ">>},
-
-                  {"|stringformat:\"d\"",
-                   <<"{{ var|stringformat:\"d\" }}">>, [{var, "90"}],
-                   <<"90">>},
-                  {"|stringformat:\"10d\"",
-                   <<"{{ var|stringformat:\"10d\" }}">>, [{var, "90"}],
-                   <<"        90">>},
-                  {"|stringformat:\"-10d\"",
-                   <<"{{ var|stringformat:\"-10d\" }}">>, [{var, "90"}],
-                   <<"90        ">>},
-                  {"|stringformat:\"i\"",
-                   <<"{{ var|stringformat:\"i\" }}">>, [{var, "90"}],
-                   <<"90">>},
-                  {"|stringformat:\"10i\"",
-                   <<"{{ var|stringformat:\"10i\" }}">>, [{var, "90"}],
-                   <<"        90">>},
-                  {"|stringformat:\"-10i\"",
-                   <<"{{ var|stringformat:\"-10i\" }}">>, [{var, "90"}],
-                   <<"90        ">>},
-                  {"|stringformat:\"0.2d\"",
-                   <<"{{ var|stringformat:\"0.2d\" }}">>, [{var, "9"}],
-                   <<"09">>},
-                  {"|stringformat:\"10.4d\"",
-                   <<"{{ var|stringformat:\"10.4d\" }}">>, [{var, "9"}],
-                   <<"      0009">>},
-                  {"|stringformat:\"-10.4d\"",
-                   <<"{{ var|stringformat:\"-10.4d\" }}">>, [{var, "9"}],
-                   <<"0009      ">>},
-
-                  {"|stringformat:\"f\"",
-                   <<"{{ var|stringformat:\"f\" }}">>, [{var, "1"}],
-                   <<"1.000000">>},
-                  {"|stringformat:\".2f\"",
-                   <<"{{ var|stringformat:\".2f\" }}">>, [{var, "1"}],
-                   <<"1.00">>},
-                  {"|stringformat:\"0.2f\"",
-                   <<"{{ var|stringformat:\"0.2f\" }}">>, [{var, "1"}],
-                   <<"1.00">>},
-                  {"|stringformat:\"-0.2f\"",
-                   <<"{{ var|stringformat:\"-0.2f\" }}">>, [{var, "1"}],
-                   <<"1.00">>},
-                  {"|stringformat:\"10.2f\"",
-                   <<"{{ var|stringformat:\"10.2f\" }}">>, [{var, "1"}],
-                   <<"      1.00">>},
-                  {"|stringformat:\"-10.2f\"",
-                   <<"{{ var|stringformat:\"-10.2f\" }}">>, [{var, "1"}],
-                   <<"1.00      ">>},
-                  {"|stringformat:\".2f\"",
-                   <<"{{ var|stringformat:\".2f\" }}">>, [{var, "1"}],
-                   <<"1.00">>},
-                  {"|stringformat:\"x\"",
-                   <<"{{ var|stringformat:\"x\" }}">>, [{var, "90"}],
-                   <<"5a">>},
-                  {"|stringformat:\"X\"",
-                   <<"{{ var|stringformat:\"X\" }}">>, [{var, "90"}],
-                   <<"5A">>},
-
-                  {"|stringformat:\"o\"",
-                   <<"{{ var|stringformat:\"o\" }}">>, [{var, "90"}],
-                   <<"132">>},
-
-                  {"|stringformat:\"e\"",
-                   <<"{{ var|stringformat:\"e\" }}">>, [{var, "90"}],
-                   <<"9.000000e+01">>},
-                  {"|stringformat:\"e\"",
-                   <<"{{ var|stringformat:\"e\" }}">>, [{var, "90000000000"}],
-                   <<"9.000000e+10">>},
-                  {"|stringformat:\"E\"",
-                   <<"{{ var|stringformat:\"E\" }}">>, [{var, "90"}],
-                   <<"9.000000E+01">>},
-                  {"|striptags",
-                   <<"{{ var|striptags }}">>, [{var, "<b>Joel</b> <button>is</button> a <span>slug</span>"}],
-                   <<"Joel is a slug">>},
-                  {"|striptags",
-                   <<"{{ var|striptags }}">>, [{var, "<B>Joel</B> <button>is</button> a <span>slug</Span>"}],
-                   <<"Joel is a slug">>},
-                  {"|striptags",
-                   <<"{{ var|striptags }}">>, [{var, "Check out <a href=\"http://www.djangoproject.com\" rel=\"nofollow\">http://www.djangoproject.com</a>"}],
-                   <<"Check out http://www.djangoproject.com">>},
-                  {"|time:\"H:i\"",
-                   <<"{{ var|time:\"H:i\" }}">>, [{var, {{2010,12,1}, {10,11,12}} }],
-                   <<"10:11">>},
-                  {"|time",
-                   <<"{{ var|time }}">>, [{var, {{2010,12,1}, {10,11,12}} }],
-                   <<"10:11 a.m.">>},
-                  {"|timesince:from_date",
-                   <<"{{ from_date|timesince:conference_date }}">>, [{conference_date, {{2006,6,1},{8,0,0}} }, {from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"8 hours">>},
-                  {"|timesince:from_date",
-                   <<"{{ from_date|timesince:conference_date }}">>, [{conference_date, {{2010,6,1},{8,0,0}} },{from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"4 years, 1 day">>}, % leap year
-                  {"|timesince:from_date",
-                   <<"{{ from_date|timesince:conference_date }}">>, [{conference_date, {{2006,7,15},{8,0,0}} },{from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"1 month, 2 weeks">>},
-                  {"|timeuntil:from_date",
-                   <<"{{ conference_date|timeuntil:from_date }}">>, [{conference_date, {{2006,6,1},{8,0,0}} }, {from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"8 hours">>},
-                  {"|timeuntil:from_date",
-                   <<"{{ conference_date|timeuntil:from_date }}">>, [{conference_date, {{2010,6,1},{8,0,0}} },{from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"4 years, 1 day">>},
-                  {"|timeuntil:from_date",
-                   <<"{{ conference_date|timeuntil:from_date }}">>, [{conference_date, {{2006,7,15},{8,0,0}} },{from_date, {{2006,6,1},{0,0,0}} }],
-                   <<"1 month, 2 weeks">>},
-                  {"|title",
-                   <<"{{ \"my title case\"|title }}">>, [],
-                   <<"My Title Case">>},
-                  {"|title (pre-formatted)",
-                   <<"{{ \"My Title Case\"|title }}">>, [],
-                   <<"My Title Case">>},
-                  {"|title (wacky separators)",
-                   <<"{{ \"my-title!case\"|title }}">>, [],
-                   <<"My-Title!Case">>},
-                  {"|title (numbers)",
-                   <<"{{ \"my-title123CaSe\"|title }}">>, [],
-                   <<"My-Title123case">>},
-                  {"|title (Irish names)",
-                   <<"{{ \"who's o'malley?\"|title }}">>, [],
-                   <<"Who's O'Malley?">>},
-                  {"|truncatechars:0",
-                   <<"{{ var1|truncatechars:0 }}">>, [{var1, "Empty Me"}],
-                   <<"...">>},
-                  {"|truncatechars:14",
-                   <<"{{ var1|truncatechars:14 }}">>, [{var1, "Truncate Me Please"}],
-                   <<"Truncate Me...">>},
-                  {"|truncatechars:17",
-                   <<"{{ var1|truncatechars:17 }}">>, [{var1, "Don't Truncate Me"}],
-                   <<"Don't Truncate Me">>},
-                  {"|truncatechars:4 (UTF-8)",
-                   <<"{{ var1|truncatechars:4 }}">>, [{var1, "\x{E2}\x{82}\x{AC}1.99"}],
-                   <<"\x{E2}\x{82}\x{AC}...">>},
-                  {"|truncatechars:5 (UTF-8)",
-                   <<"{{ var1|truncatechars:5 }}">>, [{var1, "\x{E2}\x{82}\x{AC} 1.99"}],
-                   <<"\x{E2}\x{82}\x{AC} ...">>},
-                  {"|truncatewords:0",
-                   <<"{{ var1|truncatewords:0 }}">>, [{var1, "Empty Me"}],
-                   <<" ...">>},
-                  {"|truncatewords:2",
-                   <<"{{ var1|truncatewords:2 }}">>, [{var1, "Truncate Me Please"}],
-                   <<"Truncate Me ...">>},
-                  {"|truncatewords:3",
-                   <<"{{ var1|truncatewords:3 }}">>, [{var1, "Don't Truncate Me"}],
-                   <<"Don't Truncate Me">>},
-                  {"|truncatewords_html:4",
-                   <<"{{ var1|truncatewords_html:4 }}">>, [{var1, "<p>The <strong>Long and <em>Winding</em> Road</strong> is too long</p>"}],
-                   <<"<p>The <strong>Long and <em>Winding</em>...</strong></p>">>},
-                  {"|unordered_list",
-                   <<"{{ var1|unordered_list }}">>, [{var1, ["States", ["Kansas", ["Lawrence", "Topeka"], "Illinois"]]}],
-                   <<"<li>States<ul><li>Kansas<ul><li>Lawrence</li><li>Topeka</li></ul></li><li>Illinois</li></ul></li>">>},
-                  {"|upper",
-                   <<"{{ message|upper }}">>, [{message, "That man has a gun."}],
-                   <<"THAT MAN HAS A GUN.">>},
-                  {"|urlencode",
-                   <<"{{ url|urlencode }}">>, [{url, "You #$*@!!"}],
-                   <<"You%20%23%24%2A%40%21%21">>},
-                  {"|urlencode",
-                   <<"{{ url|urlencode }}">>, [{url, "http://www.example.org/foo?a=b&c=d"}],
-                   <<"http%3A//www.example.org/foo%3Fa%3Db%26c%3Dd">>},
-                  {"|urlencode",
-                   <<"{{ url|urlencode:\"\" }}">>, [{url, "http://www.example.org/foo?a=b&c=d"}],
-                   <<"http%3A%2F%2Fwww.example.org%2Ffoo%3Fa%3Db%26c%3Dd">>},
-                  {"|urlencode",
-                   <<"{{ url|urlencode:\":/?=&\" }}">>, [{url, "http://www.example.org/foo?a=b&c=d"}],
-                   <<"http://www.example.org/foo?a=b&c=d">>},
-                  {"|urlize",
-                   <<"{{ var|urlize }}">>, [{var, "Check out www.djangoproject.com"}],
-                   <<"Check out <a href=\"http://www.djangoproject.com\" rel=\"nofollow\">www.djangoproject.com</a>">>},
-                  {"|urlize",
-                   <<"{{ var|urlize }}">>, [{var, "Check out http://www.djangoproject.com"}],
-                   <<"Check out <a href=\"http://www.djangoproject.com\" rel=\"nofollow\">http://www.djangoproject.com</a>">>},
-                  {"|urlize",
-                   <<"{{ var|urlize }}">>, [{var, "Check out \"http://www.djangoproject.com\""}],
-                   <<"Check out \"<a href=\"http://www.djangoproject.com\" rel=\"nofollow\">http://www.djangoproject.com</a>\"">>},
-                  {"|urlizetrunc:15",
-                   <<"{{ var|urlizetrunc:15 }}">>, [{var, "Check out www.djangoproject.com"}],
-                   <<"Check out <a href=\"http://www.djangoproject.com\" rel=\"nofollow\">www.djangopr...</a>">>},
-                  {"|wordcount",
-                   <<"{{ words|wordcount }}">>, [{words, "Why Hello There!"}],
-                   <<"3">>},
-                  {"|wordwrap:2",
-                   <<"{{ words|wordwrap:2 }}">>, [{words, "this is"}],
-                   <<"this \nis">>},
-                  {"|wordwrap:100",
-                   <<"{{ words|wordwrap:100 }}">>, [{words, "testing    testing"}],
-                   <<"testing    testing">>},
-                  {"|wordwrap:10",
-                   <<"{{ words|wordwrap:10 }}">>, [{words, ""}],
-                   <<"">>},
-                  {"|wordwrap:1",
-                   <<"{{ words|wordwrap:1 }}">>, [{words, "two"}],
-                   <<"two">>},
-                                                % yesno match: \?assert.*\( (.*), erlydtl_filters:(.*)\((.*), "(.*)"\)\)
-                                                % yesno replace: \t\t{"|$2:\"$4\"",\n\t\t\t\t\t <<"{{ var|$2:\"$4\" }}">>, [{var, $3}],\n\t\t\t\t\t<<$1>>}
-                  {"|yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, true}],
-                   <<"yeah">>},
-                  {"|yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, false}],
-                   <<"no">>},
-                  {"|yesno:\"yeah,no\"",
-                   <<"{{ var|yesno:\"yeah,no\" }}">>, [{var, undefined}],
-                   <<"no">>},
-                  {"|yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, undefined}],
-                   <<"maybe">>},
-
-                  {"string |yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, "non-empty string"}],
-                   <<"yeah">>},
-                  {"binary |yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, <<"non-empty binary">>}],
-                   <<"yeah">>},
-                  {"empty string |yesno:\"yeah,no,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, ""}],
-                   <<"no">>},
-                  {"empty binary |yesno:\"yeah,no\"",
-                   <<"{{ var|yesno:\",no\" }}">>, [{var, <<"">>}],
-                   <<"no">>},
-                  {"term |yesno:\"yeah,,maybe\"",
-                   <<"{{ var|yesno:\"yeah,no,maybe\" }}">>, [{var, {my, [term, "test"]}}],
-                   <<"yeah">>},
-                  {"|yesno:\"yeah,\"",
-                   <<"{{ var|yesno:\"yeah,\" }}">>, [{var, false}],
-                   <<"">>},
-                  {"|yesno:\"yeah,,maybe\"",
-                   <<"{{ var|yesno:\"yeah,,maybe\" }}">>, [{var, false}],
-                   <<"">>},
-                  {"|yesno:\"missing_false_choice\"",
-                   <<"{{ var|yesno:\"missing_false_choice\" }}">>, [{var, true}],
-                   {error, {yesno, choices}}}
-                 ]},
-     {"filters_if", [
-                     {"Filter if 1.1",
-                      <<"{% if var1|length_is:0 %}Y{% else %}N{% endif %}">>,
-                      [{var1, []}],
-                      <<"Y">>},
-                     {"Filter if 1.2",
-                      <<"{% if var1|length_is:1 %}Y{% else %}N{% endif %}">>,
-                      [{var1, []}],
-                      <<"N">>},
-                     {"Filter if 1.3",
-                      <<"{% if var1|length_is:7 %}Y{% else %}N{% endif %}">>,
-                      [{var1, []}],
-                      <<"N">>},
-                     {"Filter if 2.1",
-                      <<"{% if var1|length_is:0 %}Y{% else %}N{% endif %}">>,
-                      [{var1, ["foo"]}],
-                      <<"N">>},
-                     {"Filter if 2.2",
-                      <<"{% if var1|length_is:1 %}Y{% else %}N{% endif %}">>,
-                      [{var1, ["foo"]}],
-                      <<"Y">>},
-                     {"Filter if 2.3",
-                      <<"{% if var1|length_is:7 %}Y{% else %}N{% endif %}">>,
-                      [{var1, ["foo"]}],
-                      <<"N">>},
-                     {"Filter if 3.1",
-                      <<"{% ifequal var1|length 0 %}Y{% else %}N{% endifequal %}">>,
-                      [{var1, []}],
-                      <<"Y">>},
-                     {"Filter if 3.2",
-                      <<"{% ifequal var1|length 1 %}Y{% else %}N{% endifequal %}">>,
-                      [{var1, []}],
-                      <<"N">>},
-                     {"Filter if 4.1",
-                      <<"{% ifequal var1|length 3 %}Y{% else %}N{% endifequal %}">>,
-                      [{var1, ["foo", "bar", "baz"]}],
-                      <<"Y">>},
-                     {"Filter if 4.2",
-                      <<"{% ifequal var1|length 0 %}Y{% else %}N{% endifequal %}">>,
-                      [{var1, ["foo", "bar", "baz"]}],
-                      <<"N">>},
-                     {"Filter if 4.3",
-                      <<"{% ifequal var1|length 1 %}Y{% else %}N{% endifequal %}">>,
-                      [{var1, ["foo", "bar", "baz"]}],
-                      <<"N">>}
-                    ]},
-     {"firstof", [
-                  {"Firstof first",
-                   <<"{% firstof foo bar baz %}">>,
-                   [{foo, "1"},{bar, "2"}],
-                   <<"1">>},
-                  {"Firstof second",
-                   <<"{% firstof foo bar baz %}">>,
-                   [{bar, "2"}],
-                   <<"2">>},
-                  {"Firstof none",
-                   <<"{% firstof foo bar baz %}">>,
-                   [],
-                   <<"">>},
-                  {"Firstof complex",
-                   <<"{% firstof foo.bar.baz bar %}">>,
-                   [{foo, [{bar, [{baz, "quux"}]}]}],
-                   <<"quux">>},
-                  {"Firstof undefined complex",
-                   <<"{% firstof foo.bar.baz bar %}">>,
-                   [{bar, "bar"}],
-                   <<"bar">>},
-                  {"Firstof literal",
-                   <<"{% firstof foo bar \"baz\" %}">>,
-                   [],
-                   <<"baz">>}
-                 ]},
-     {"regroup .. endregroup",
-      [{"Ordered",
-        <<"{% regroup people by gender as gender_list %}{% for gender in gender_list %}{{ gender.grouper }}\n{% for item in gender.list %}{{ item.first_name }}\n{% endfor %}{% endfor %}{% endregroup %}">>,
-        [{people, [[{first_name, "George"}, {gender, "Male"}], [{first_name, "Bill"}, {gender, "Male"}],
-                   [{first_name, "Margaret"}, {gender, "Female"}], [{first_name, "Condi"}, {gender, "Female"}]]}],
-        <<"Male\nGeorge\nBill\nFemale\nMargaret\nCondi\n">>},
-       {"Unordered",
-        <<"{% regroup people by gender as gender_list %}{% for gender in gender_list %}{{ gender.grouper }}\n{% for item in gender.list %}{{ item.first_name }}\n{% endfor %}{% endfor %}{% endregroup %}">>,
-        [{people, [[{first_name, "George"}, {gender, "Male"}],
-                   [{first_name, "Margaret"}, {gender, "Female"}],
-                   [{first_name, "Condi"}, {gender, "Female"}],
-                   [{first_name, "Bill"}, {gender, "Male"}]
-                  ]}],
-        <<"Male\nGeorge\nFemale\nMargaret\nCondi\nMale\nBill\n">>},
-       {"NestedOrdered",
-        <<"{% regroup people by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}{% endregroup %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Costanza\nGeorge\nMargaret\nBuffalo\nBill\nCondi\n">>},
-       {"NestedUnordered",
-        <<"{% regroup people by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}{% endregroup %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Costanza\nGeorge\nBuffalo\nBill\nCostanza\nMargaret\nBuffalo\nCondi\n">>},
-       {"Filter",
-        <<"{% regroup people|dictsort:\"name.last\" by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}{% endregroup %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Buffalo\nBill\nCondi\nCostanza\nGeorge\nMargaret\n">>}
-      ]},
-     {"regroup",
-      [{"Ordered",
-        <<"{% regroup people by gender as gender_list %}{% for gender in gender_list %}{{ gender.grouper }}\n{% for item in gender.list %}{{ item.first_name }}\n{% endfor %}{% endfor %}">>,
-        [{people, [[{first_name, "George"}, {gender, "Male"}], [{first_name, "Bill"}, {gender, "Male"}],
-                   [{first_name, "Margaret"}, {gender, "Female"}], [{first_name, "Condi"}, {gender, "Female"}]]}],
-        <<"Male\nGeorge\nBill\nFemale\nMargaret\nCondi\n">>},
-       {"Unordered",
-        <<"{% regroup people by gender as gender_list %}{% for gender in gender_list %}{{ gender.grouper }}\n{% for item in gender.list %}{{ item.first_name }}\n{% endfor %}{% endfor %}">>,
-        [{people, [[{first_name, "George"}, {gender, "Male"}],
-                   [{first_name, "Margaret"}, {gender, "Female"}],
-                   [{first_name, "Condi"}, {gender, "Female"}],
-                   [{first_name, "Bill"}, {gender, "Male"}]
-                  ]}],
-        <<"Male\nGeorge\nFemale\nMargaret\nCondi\nMale\nBill\n">>},
-       {"NestedOrdered",
-        <<"{% regroup people by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Costanza\nGeorge\nMargaret\nBuffalo\nBill\nCondi\n">>},
-       {"NestedUnordered",
-        <<"{% regroup people by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Costanza\nGeorge\nBuffalo\nBill\nCostanza\nMargaret\nBuffalo\nCondi\n">>},
-       {"Filter",
-        <<"{% regroup people|dictsort:\"name.last\" by name.last as lastname_list %}{% for lastname in lastname_list %}{{ lastname.grouper }}\n{% for item in lastname.list %}{{ item.name.first }}\n{% endfor %}{% endfor %}">>,
-        [{people, [[{name, [{first,"George"},{last,"Costanza"}]}],
-                   [{name, [{first,"Bill"},{last,"Buffalo"}]}],
-                   [{name, [{first,"Margaret"},{last,"Costanza"}]}],
-                   [{name, [{first,"Condi"},{last,"Buffalo"}]}]]}],
-        <<"Buffalo\nBill\nCondi\nCostanza\nGeorge\nMargaret\n">>},
-       {"With surrounding context",
-        <<"People: {% regroup people by gender as gender_list %}{% for gender in gender_list %}{{ gender.grouper }}\n{% for item in gender.list %}{{ item.first_name }}\n{% endfor %}{% endfor %}Done.">>,
-        [{people, [[{first_name, "George"}, {gender, "Male"}], [{first_name, "Bill"}, {gender, "Male"}],
-                   [{first_name, "Margaret"}, {gender, "Female"}], [{first_name, "Condi"}, {gender, "Female"}]]}],
-        <<"People: Male\nGeorge\nBill\nFemale\nMargaret\nCondi\nDone.">>}
-      ]},
-     {"spaceless", [
-                    {"Beginning", <<"{% spaceless %}    <b>foo</b>{% endspaceless %}">>, [], <<"<b>foo</b>">>},
-                    {"Middle", <<"{% spaceless %}<b>foo</b>  <b>bar</b>{% endspaceless %}">>, [], <<"<b>foo</b><b>bar</b>">>},
-                    {"End", <<"{% spaceless %}<b>foo</b>  {% endspaceless %}">>, [], <<"<b>foo</b>">>},
-                    {"NewLine", <<"{% spaceless %}\n<div> \n <b>foo</b> \n </div>\n {% endspaceless %}">>, [], <<"<div><b>foo</b></div>">>}
-                   ]},
-     {"templatetag", [
-                      {"openblock", <<"{% templatetag openblock %}">>, [], <<"{%">>},
-                      {"closeblock", <<"{% templatetag closeblock %}">>, [], <<"%}">>},
-                      {"openvariable", <<"{% templatetag openvariable %}">>, [], <<"{{">>},
-                      {"closevariable", <<"{% templatetag closevariable %}">>, [], <<"}}">>},
-                      {"openbrace", <<"{% templatetag openbrace %}">>, [], <<"{">>},
-                      {"closebrace", <<"{% templatetag closebrace %}">>, [], <<"}">>},
-                      {"opencomment", <<"{% templatetag opencomment %}">>, [], <<"{#">>},
-                      {"closecomment", <<"{% templatetag closecomment %}">>, [], <<"#}">>}
-                     ]},
-     {"trans",
-      [
-       {"trans functional default locale",
-        <<"Hello {% trans \"Hi\" %}">>, [], <<"Hello Hi">>
-       },
-       {"trans functional reverse locale",
-        <<"Hello {% trans \"Hi\" %}">>, [], [{locale, "reverse"}],
-        [{blocktrans_locales, ["reverse"]}, {blocktrans_fun, fun("Hi"=Key, "reverse") -> list_to_binary(lists:reverse(Key)) end}],
-        <<"Hello iH">>
-       },
-       {"trans literal at run-time",
-        <<"Hello {% trans \"Hi\" %}">>, [], [{translation_fun, fun("Hi") -> "Konichiwa" end}], [],
-        <<"Hello Konichiwa">>},
-       {"trans variable at run-time",
-        <<"Hello {% trans var1 %}">>, [{var1, <<"Hi">>}], [{translation_fun, fun(<<"Hi">>) -> <<"Konichiwa">> end}], [],
-        <<"Hello Konichiwa">>},
-       {"trans literal at run-time: No-op",
-        <<"Hello {% trans \"Hi\" noop %}">>, [], [{translation_fun, fun("Hi") -> <<"Konichiwa">> end}], [],
-        <<"Hello Hi">>},
-       {"trans variable at run-time: No-op",
-        <<"Hello {% trans var1 noop %}">>, [{var1, <<"Hi">>}], [{translation_fun, fun(<<"Hi">>) -> <<"Konichiwa">> end}], [],
-        <<"Hello Hi">>},
-       {"trans as",
-        <<"{% trans 'Hans' as name %}Hello {{ name }}">>, [], <<"Hello Hans">>
-       }
-      ]},
-     {"blocktrans",
-      [
-       {"blocktrans default locale",
-        <<"{% blocktrans %}Hello{% endblocktrans %}">>, [], <<"Hello">>},
-       {"blocktrans choose locale",
-        <<"{% blocktrans %}Hello, {{ name }}{% endblocktrans %}">>, [{name, "Mr. President"}], [{locale, "de"}],
-        [{blocktrans_locales, ["de"]}, {blocktrans_fun, fun("Hello, {{ name }}", "de") -> <<"Guten tag, {{ name }}">> end}], <<"Guten tag, Mr. President">>},
-       {"blocktrans with args",
-        <<"{% blocktrans with var1=foo %}{{ var1 }}{% endblocktrans %}">>, [{foo, "Hello"}], <<"Hello">>},
-       {"blocktrans blocks in content not allowed",
-        <<"{% blocktrans %}Hello{%if name%}, {{ name }}{%endif%}!{% endblocktrans %}">>, [],
-        {error, [error_info([{{1, 24}, erlydtl_parser, ["syntax error before: ",["\"if\""]]}])], []}},
-       {"blocktrans nested variables not allowed",
-        <<"{% blocktrans %}Hello, {{ user.name }}!{% endblocktrans %}">>, [],
-        {error, [error_info([{{1,31}, erlydtl_parser, ["syntax error before: ","'.'"]}])], []}},
-       {"blocktrans runtime",
-        <<"{% blocktrans with v1=foo%}Hello, {{ name }}! See {{v1}}.{%endblocktrans%}">>,
-        [{name, "Mr. President"}, {foo, <<"rubber-duck">>}],
-        [{translation_fun, fun("Hello, {{ name }}! See {{ v1 }}.") -> <<"Guten tag, {{name}}! Sehen {{    v1   }}.">> end}],
-        [], <<"Guten tag, Mr. President! Sehen rubber-duck.">>}
-      ]},
-     {"verbatim", [
-                   {"Plain verbatim",
-                    <<"{% verbatim %}{{ oh no{% foobar %}{% endverbatim %}">>, [],
-                    <<"{{ oh no{% foobar %}">>},
-                   {"Named verbatim",
-                    <<"{% verbatim foobar %}{% verbatim %}{% endverbatim foobar2 %}{% endverbatim foobar %}">>, [],
-                    <<"{% verbatim %}{% endverbatim foobar2 %}">>}
-                  ]},
-     {"widthratio", [
-                     {"Literals", <<"{% widthratio 5 10 100 %}">>, [], <<"50">>},
-                     {"Rounds up", <<"{% widthratio a b 100 %}">>, [{a, 175}, {b, 200}], <<"88">>}
-                    ]},
-     {"with", [
-               {"Cache literal",
-                <<"{% with a=1 %}{{ a }}{% endwith %}">>, [], <<"1">>},
-               {"Cache variable",
-                <<"{% with a=b %}{{ a }}{% endwith %}">>, [{b, "foo"}], <<"foo">>},
-               {"Cache variable with attribute",
-                <<"I enjoy {% with a = var1 %}{{ a.game }}{% endwith %}">>, [{var1, [{game, "Othello"}]}], <<"I enjoy Othello">>},
-               {"Cache variable attribute",
-                <<"I enjoy {% with a = var1.game %}{{ a }}{% endwith %}">>, [{var1, [{game, "Othello"}]}], <<"I enjoy Othello">>},
-               {"Cache multiple",
-                <<"{% with alpha=1 beta=b %}{{ alpha }}/{{ beta }}{% endwith %}">>, [{b, 2}], <<"1/2">>}
-              ]},
-     {"unicode", [
-                  {"(tm) somewhere",
-                   <<"™">>, [], <<"™">>}
-                 ]},
-     {"contrib_humanize", [
-                           {"intcomma",
-                            <<"{{ a|intcomma }} {{ b|intcomma }} {{ c|intcomma }} {{ d|intcomma }}">>,
-                            [{a, 999}, {b, 123456789}, {c, 12345}, {d, 1234567890}],
-                            <<"999 123,456,789 12,345 1,234,567,890">>}
-                          ]},
-     %% custom syntax stuff
-     {"extension_module",
-      [ %% the erlydtl_extension_test module replaces a foo identifier with bar when hitting a # following foo.
-        {"replace parsed token", <<"{{ foo # }}">>, [{bar, "ok"}], [],
-         [{extension_module, erlydtl_extension_test}], <<"ok">>},
-        {"proper error message", <<"{{ bar # }}">>, [{bar, "ok"}], [],
-         [{extension_module, erlydtl_extension_test}],
-         {error, [error_info([{1,erlydtl_extension_test,"Unexpected '#' in code at column 8"}])], []}},
-        %% accept identifiers as expressions (this is a dummy functionality to test the parser extensibility)
-        {"identifiers as expressions", <<"{{ foo.bar or baz }}">>, [{baz, "ok"}], [],
-         [{extension_module, erlydtl_extension_test}], <<"ok">>}
-      ]},
-     {"records",
-      [{"field access",
-        <<"{{ r.baz }}">>, [{r, #testrec{ foo="Foo", bar="Bar", baz="Baz" }}], [],
-        [{record_info, [{testrec, record_info(fields, testrec)}]}],
-        <<"Baz">>}
-      ]},
-     {"error reporting",
-      [{"no out dir warning",
-        <<"foo bar">>,
-        [], [], %% Vars, RenderOpts
-        ?GRP_ERROR_REPORTING_COMPILER_OPTS, %% CompilerOpts
-        <<"foo bar">>, %% Output
-        [error_info([no_out_dir])] %% Warnings
-       },
-       {"warnings as errors",
-        <<"foo bar">>,
-        [], [],
-        [warnings_as_errors|?GRP_ERROR_REPORTING_COMPILER_OPTS],
-        {error, %% Output...
-         [error_info([no_out_dir])], %% Errors
-         [] %% Warnings
-        }
-       },
-       {"illegal character",
-        <<"{{{">>,
-        [], [],
-        ?GRP_ERROR_REPORTING_COMPILER_OPTS,
-        {error,
-         [error_info(
-            [{{1,3},erlydtl_scanner,{illegal_char, ${}}] )],
-         []}
-       },
-       {"unexpected end of file - in code",
-        <<"{{">>,
-        [], [],
-        ?GRP_ERROR_REPORTING_COMPILER_OPTS,
-        {error,
-         [error_info(
-            [{{1,3},erlydtl_scanner,{eof, in_code}}] )],
-         []}
-       },
-       {"unexpected end of file - in comment",
-        <<"{#">>,
-        [], [],
-        ?GRP_ERROR_REPORTING_COMPILER_OPTS,
-        {error,
-         [error_info(
-            [{{1,3},erlydtl_scanner,{eof, in_comment}}] )],
-         []}
-       },
-       {"unknown library",
-        <<"{% load foo %}">>, [], [],
-        ?GRP_ERROR_REPORTING_COMPILER_OPTS,
-        <<>>,
-        [error_info(
-           [no_out_dir,
-            {{1,9},erlydtl_compiler_utils,{load_library,foo,foo,nofile}}
-           ])]
-       },
-       {"not a library",
-        <<"{% load foo %}">>, [], [],
-        [{libraries, [{foo, ?MODULE}]}|?GRP_ERROR_REPORTING_COMPILER_OPTS],
-        <<>>,
-        [error_info(
-           [no_out_dir,
-            {{1,9},erlydtl_compiler_utils,{load_library,foo,?MODULE,behaviour}}
-           ])]
-       },
-       {"library version",
-        <<"{% load foo %}">>, [], [],
-        [{libraries, [{foo, erlydtl_lib_testversion}]}|?GRP_ERROR_REPORTING_COMPILER_OPTS],
-        <<>>,
-        [error_info(
-           [no_out_dir,
-            {{1,9},erlydtl_compiler_utils,{load_library,foo,erlydtl_lib_testversion,{version,invalid}}}
-           ])]
-       },
-       {"not in library",
-        <<"{% load foo bar from test1 %}\n{{ \"w00t\"|reverse }}">>, [], [],
-        [{libraries, [{test1, erlydtl_lib_test1}]}|?GRP_ERROR_REPORTING_COMPILER_OPTS],
-        <<"\n">>,
-        [error_info(
-           [no_out_dir,
-            {{2,11},erlydtl_beam_compiler,{unknown_filter,reverse,1}},
-            {{1,22},erlydtl_compiler_utils,{load_from,test1,erlydtl_lib_test1,foo}},
-            {{1,22},erlydtl_compiler_utils,{load_from,test1,erlydtl_lib_test1,bar}}
-           ])]
-       },
-       {"pre load unknown library",
-        <<"{{ '123'|reverse }}">>, [], [],
-        [{default_libraries, [test1]}],
-        <<"">>,
-        [error_info(
-           [no_out_dir,
-            {{1,10},erlydtl_beam_compiler,{unknown_filter,reverse,1}},
-            {none,erlydtl_compiler_utils,{load_library,test1,test1,nofile}}
-           ])]
-       },
-       {"pre load unknown legacy library",
-        <<"{% foo %}">>, [], [],
-        [{custom_tags_modules, [foo]}],
-        <<"">>,
-        [error_info(
-          [no_out_dir,
-           {none,erlydtl_compiler,{load_library,'(custom-legacy)',foo,nofile}}
-          ])]
-       },
-       {"unknown filter",
-        <<"{{ '123'|foo }}">>, [], [], [],
-        <<"">>,
-        [error_info([no_out_dir, {{1,10},erlydtl_beam_compiler,{unknown_filter,foo,1}}])]
-       },
-       {"ssi file not found",
-        <<"{% ssi 'foo' %}">>, [],
-        {error, {read_file, <<"./foo">>, enoent}}
-       }
-      ]},
-     {"load",
-      [{"filter",
-        <<"{% load test1 %}{{ \"1234\"|reverse }}">>, [], [],
-        [{libraries, [{test1, erlydtl_lib_test1}]}],
-        <<"4321">>
-       },
-       {"named",
-        <<"{% load reverse from test1 %}{{ \"abcd\"|reverse }}">>, [], [],
-        [{libraries, [{test1, erlydtl_lib_test1}]}],
-        <<"dcba">>
-       },
-       {"pre loaded",
-        <<"{{ QWER|reverse }}">>, [{'QWER', "Qwerty"}], [],
-        [{default_libraries, [test1]},
-         {libraries, [{test1, erlydtl_lib_test1}]}],
-        <<"ytrewQ">>
-       }
-      ]}
-    ].
-
-%% {Name, DTL, Vars, Output}
-%% {Name, DTL, Vars, RenderOpts, Output}
-%% {Name, DTL, Vars, RenderOpts, CompilerOpts, Output}
-%% {Name, DTL, Vars, RenderOpts, CompilerOpts, Output, Warnings}
-
-run_tests() ->
-    io:format("Running unit tests..."),
-    {Times, Failures} =
-        lists:foldl(
-          fun({Group, Assertions}, {GroupTs, GroupEs}) ->
-                  io:format("~n Test group ~p ", [Group]),
-                  {Ts, Es} =
-                      lists:foldl(
-                        fun(Setup, {Ts, Es}) ->
-                                try process_unit_test(Setup) of
-                                    {ok, T} ->
-                                        io:format("."),
-                                        {merge_times(T, Ts), Es};
-                                    {T, E} ->
-                                        io:format("!"),
-                                        {merge_times(T, Ts), [E|Es]}
-                                catch
-                                    Class:Error ->
-                                        {Ts, [format_error(
-                                                element(1, Setup),
-                                                Class, Error)
-                                              |Es]}
-                                end
-                        end, {[], []}, Assertions),
-                  Ts1 = merge_times(Ts, GroupTs),
-                  if length(Es) =:= 0 ->
-                          io:format("~n~s (msec)", [format_times(Ts, length(Assertions))]),
-                          {Ts1, GroupEs};
-                     true ->
-                          {Ts1, [{Group, Es}|GroupEs]}
-                  end
-          end, {[], []}, tests()),
-
-    case length(Failures) of
-        0 ->
-            io:format("~nAll unit tests PASS~nTotal~s (msec)~n~n", [format_times(Times)]);
-        Length ->
-            io:format("~n~n### FAILED groups: ~b ####~n", [Length]),
-            [begin
-                 io:format("~n  Group: ~s (~b failures)~n", [Group, length(Failed)]),
-                 [io:format("~n  Test: ~s~n    ~s~n", [Name, Error])
-                  || {Name, Error} <- lists:reverse(Failed)]
-             end || {Group, Failed} <- lists:reverse(Failures)],
-            throw(failed)
-    end.
-
-merge_times(Ts1, Ts2) ->
-    merge_times(Ts1, Ts2, []).
-
-merge_times([{K, V1}|Ts1], [{K, V2}|Ts2], Acc) ->
-    merge_times(Ts1, Ts2, [{K, V1 + V2}|Acc]);
-merge_times(Ts1, [T|Ts2], Acc) ->
-    merge_times(Ts1, Ts2, [T|Acc]);
-merge_times([T|Ts1], [], Acc) ->
-    merge_times(Ts1, [], [T|Acc]);
-merge_times([], [], Acc) ->
-    lists:reverse(Acc).
-
-format_times(Ts) ->
-    [io_lib:format("  ~p ~.3f", [K, V / 1000]) || {K, V} <- Ts].
-
-format_times(Ts, Count) ->
-    [io_lib:format("  ~p ~.3f (~.3f)", [K, V / 1000, V / 1000 / Count])
-     || {K, V} <- Ts].
-
-format_error(Name, Class, Error) ->
-    io:format("!"),
-    {Name, io_lib:format("~s:~p~n    ~p", [Class, Error, erlang:get_stacktrace()])}.
-
-compile_test(DTL, Opts) ->
-    Options = [force_recompile,
-               {auto_escape, false},
-               return_errors, return_warnings,
-               {custom_filters_modules, [erlydtl_contrib_humanize]}
-               |Opts],
-    timer:tc(erlydtl, compile, [DTL, erlydtl_running_test, Options]).
-
-render_test(Vars, RenderOpts) ->
-    timer:tc(erlydtl_running_test, render, [Vars, RenderOpts]).
-
-test_pass(T) ->
-    {ok, T}.
-
-test_fail(Name, Fmt, Args, T) ->
-    {T, {Name, io_lib:format(Fmt, Args)}}.
-
-process_unit_test({Name, DTL, Vars, Output}) ->
-    process_unit_test({Name, DTL, Vars, [], [], Output, default_warnings()});
-process_unit_test({Name, DTL, Vars, RenderOpts, Output}) ->
-    process_unit_test({Name, DTL, Vars, RenderOpts, [], Output, default_warnings()});
-process_unit_test({Name, DTL, Vars, RenderOpts, CompilerOpts, Output}) ->
-    process_unit_test({Name, DTL, Vars, RenderOpts, CompilerOpts, Output, default_warnings()});
-process_unit_test({Name, DTL, Vars, RenderOpts, CompilerOpts, Output, Warnings}) ->
-    case compile_test(DTL, CompilerOpts) of
-        {Tcompile, {ok, _, Warnings}} ->
-            Tc = [{compile, Tcompile}],
-            case render_test(Vars, RenderOpts) of
-                {TrenderL, {ok, IOList}} ->
-                    TrL = [{render_list, TrenderL}|Tc],
-                    case render_test(vars_to_binary(Vars), RenderOpts) of
-                        {TrenderB, {ok, IOListBin}} ->
-                            TrB = [{render_binary, TrenderB}|TrL],
-                            case {iolist_to_binary(IOList), iolist_to_binary(IOListBin)} of
-                                {Output, Output} ->
-                                    test_pass(TrB);
-                                {Output, Unexpected} ->
-                                    test_fail(
-                                      Name,
-                                      "Unexpected result with binary variables:~n"
-                                      "    Expected: ~p~n"
-                                      "    Actual  : ~p",
-                                      [Output, Unexpected], TrB);
-                                {Unexpected, Output} ->
-                                    test_fail(
-                                      Name,
-                                      "Unexpected result with list variables:~n"
-                                      "    Expected: ~p~n"
-                                      "    Actual  : ~p",
-                                      [Output, Unexpected], TrB);
-                                {Unexpected1, Unexpected2} ->
-                                    test_fail(
-                                      Name,
-                                      "Unexpected result:~n"
-                                      "    Expected       : ~p~n"
-                                      "    Actual (list)  : ~p~n"
-                                      "    Actual (binary): ~p",
-                                      [Output, Unexpected1, Unexpected2], TrB)
-                            end;
-                        {TrenderB, Output} ->
-                            test_pass([{render_binary, TrenderB}|TrL]);
-                        {TrenderB, Err} ->
-                            test_fail(Name, "Render error (with binary variables): ~p", [Err],
-                                      [{render_binary, TrenderB}|TrL])
-                    end;
-                {TrenderL, Output} ->
-                    test_pass([{render_list, TrenderL}|Tc]);
-                {TrenderL, Err} ->
-                    test_fail(Name, "Render error (with list variables): ~p", [Err],
-                              [{render_list, TrenderL}|Tc])
-            end;
-        {Tcompile, {ok, _, ActualWarnings}} ->
-            test_fail(
-              Name,
-              "Unexpected warnings:~n"
-              "    Expected: ~p~n"
-              "    Actual  : ~p",
-              [Warnings, ActualWarnings], [{compile, Tcompile}]);
-        {Tcompile, Output} -> test_pass([{compile, Tcompile}]);
-        {Tcompile, Err} ->
-            test_fail(Name,
-                      "Compile error:~n"
-                      "    Expected: ~p~n"
-                      "    Actual  : ~p",
-                      [Output, Err], [{compile, Tcompile}])
-    end.
-
-
-vars_to_binary(Vars) when is_list(Vars) ->
-    lists:map(fun
-                  ({Key, [H|_] = Value}) when is_tuple(H) ->
-                     {Key, vars_to_binary(Value)};
-                  ({Key, [H|_] = Value}) when is_integer(H) ->
-                     {Key, list_to_binary(Value)};
-                  ({Key, Value}) ->
-                     {Key, Value}
-             end, Vars);
-vars_to_binary(Vars) ->
-    Vars.
-
-generate_test_date() ->
-    {{Y,M,D}, _} = erlang:localtime(),
-    MonthName = [
-                 "January", "February", "March", "April",
-                 "May", "June", "July", "August", "September",
-                 "October", "November", "December"
-                ],
-    OrdinalSuffix = [
-                     "st","nd","rd","th","th","th","th","th","th","th", % 1-10
-                     "th","th","th","th","th","th","th","th","th","th", % 10-20
-                     "st","nd","rd","th","th","th","th","th","th","th", % 20-30
-                     "st"
-                    ],
-    list_to_binary([
-                    "It is the ",
-                    integer_to_list(D),
-                    lists:nth(D, OrdinalSuffix),
-                    " of ", lists:nth(M, MonthName),
-                    " ", integer_to_list(Y), "."
-                   ]).
-
-
-default_warnings() ->
-    [error_info([no_out_dir], erlydtl_beam_compiler)].
-
-error_info(File, Ws, Mod) ->
-    {File, [error_info(W, Mod) || W <- Ws]}.
-
-error_info({Line, ErrorDesc}, Mod)
-  when is_integer(Line); Line =:= none ->
-  {Line, Mod, ErrorDesc};
-error_info({Line, Module, _}=ErrorDesc, _Mod)
-  when is_integer(Line), is_atom(Module) ->
-    ErrorDesc;
-error_info({none, Module, _}=ErrorDesc, _Mod)
-  when is_atom(Module) ->
-    ErrorDesc;
-error_info({{Line, Col}, Module, _}=ErrorDesc, _Mod)
-  when is_integer(Line), is_integer(Col), is_atom(Module) ->
-    ErrorDesc;
-error_info(Ws, Mod) when is_list(Ws) ->
-    error_info("erlydtl_running_test", Ws, Mod);
-error_info(ErrorDesc, Mod) ->
-    {none, Mod, ErrorDesc}.
-
-error_info(Ei) ->
-    error_info(Ei, erlydtl_beam_compiler).

+ 0 - 10
tests/src/gettext.erl

@@ -1,10 +0,0 @@
-%% Dummy impl of a gettext connector
--module(gettext).
--export([key2str/2]).
-
-key2str(String, Locale)->
- 		case Locale of
-                        undefined -> String;
-                        "reverse" -> lists:reverse(String);
-                        _ -> throw(only_undefined_and_reverse_locale_allowed_on_test)
-                end.

+ 0 - 55
tests/src/sources_parser_unittests.erl

@@ -1,55 +0,0 @@
--module(sources_parser_unittests).
-
--export([run_tests/0]).
-
-tests() ->
-    [{"trans",
-      [{"block with no trans",
-        <<"<html>{% block main %} {% endblock %}</html>">>,
-        []},
-       {"block with trans",
-        <<"<html>{% block main %} {% trans \"Hello\" %} {% endblock %}</html>">>,
-        [{"Hello",{"dummy_path",1,33}}]},
-       {"for with trans",
-        <<"<html>{% block main %} {%for thing in things %}{% trans \"Hello inside a for\" %}  {% endfor %} {% endblock %}</html>">>,
-        [{"Hello inside a for",{"dummy_path",1,57}}]},
-       {"if with trans",
-        <<"<html>{% block content %}{% if thing %} {% trans \"Hello inside an if\" %} {% endif %} {% endblock %}</html>">>,
-        [{"Hello inside an if",{"dummy_path",1,50}}]},
-       {"if with trans inside a for",
-        <<"<html>{% block content %}{%for thin in things %}{% if thing %} {% trans \"Hello inside an if inside a for\" %} {% endif %} {% endfor %}{% endblock %}</html>">>,
-        [{"Hello inside an if inside a for",{"dummy_path",1,73}}]},
-       {"if and else both with trans",
-        <<"<html>{% block content %}{% if thing %} {% trans \"Hello inside an if\" %} {% else %} {% trans \"Hello inside an else\" %} {% endif %} {% endblock %}</html>">>,
-        [ {"Hello inside an else",{"dummy_path",1,94}}, {"Hello inside an if",{"dummy_path",1,50}}]}
-      ]}
-    ].
-
-run_tests() ->
-    io:format("Running source parser unit tests...~n"),
-    Failures = lists:foldl(
-                 fun({Group, Assertions}, GroupAcc) ->
-                         io:format(" Test group ~p...~n", [Group]),
-                         lists:foldl(fun({Name, Content, Output}, Acc) ->
-                                             process_unit_test(Content, Output, Acc, Group, Name)
-                                     end, GroupAcc, Assertions)
-                 end, [], tests()),
-
-    case Failures of
-        [] ->
-            io:format("All source parser tests PASS~n~n");
-        _ ->
-            io:format("Source parser unit test failures~n"),
-            [io:format("  Test: ~s.~s~n    Expected: ~p~n    Actual: ~s~n",
-                       [Group, Name, Expected, Actual])
-             || {Group, Name, _, {expected, Expected}, {found, Actual}} <- Failures],
-            throw(failed)
-    end.
-
-process_unit_test(Content, Output, Acc, Group, Name) ->
-    Tokens = (catch sources_parser:process_content("dummy_path", Content)),
-    %%io:format("Tokens are: ~p~n", [Tokens]),
-    case Tokens of
-        Output -> Acc;
-        _ ->    [{Group, Name, 'binary', {expected, Output}, {found, Tokens} } | Acc]
-    end.