Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added mapl test

  • Loading branch information...
commit 7e57ad94182eaad8f231384334fa12bbf0b70eb2 1 parent 68177b8
@filippo authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 test/src/sgte_test_map.erl
View
16 test/src/sgte_test_map.erl
@@ -1,6 +1,6 @@
-module(sgte_test_map).
--export([test_map/0, test_map_on_empty_list/0, test_mmap/0]).
+-export([test_map/0, test_mapl/0, test_map_on_empty_list/0, test_mmap/0]).
-export([test_imap/0,test_imap2/0, test_imap_name_place/0]).
-export([test_imap_js/0, test_imap_comma/0]).
@@ -20,6 +20,17 @@ test_map() ->
Rendered = "<ul><li><b>Monte Bianco</b></li><li><b>Cerro Torre</b></li><li><b>Mt. Everest</b></li><li><b>Catinaccio</b></li></ul>",
sgeunit:assert_equal(Res, Rendered).
+test_mapl() ->
+ {ok, RowTmpl} = sgte:compile("- $attr$\n"),
+ {ok, MapLTmpl} = sgte:compile("$mapl rowTmpl nameList$"),
+ Data = [{rowTmpl, RowTmpl}, {nameList, mountain_list()}],
+ Res = sgte:render(MapLTmpl, Data),
+ Rendered = "- Monte Bianco\n"
+ "- Cerro Torre\n"
+ "- Mt. Everest\n"
+ "- Catinaccio\n",
+ sgeunit:assert_equal(Res, Rendered).
+
test_map_on_empty_list() ->
{ok, PrintM} = sgte:compile(print_mountain()),
{ok, PrintMList} = sgte:compile(print_mountains()),
@@ -147,6 +158,9 @@ empty() ->
mountains() ->
[{mountain, "Monte Bianco"}, {mountain, "Cerro Torre"}, {mountain, "Mt. Everest"}, {mountain, "Catinaccio"}].
+mountain_list() ->
+ ["Monte Bianco", "Cerro Torre", "Mt. Everest", "Catinaccio"].
+
mountains2() ->
[[{mountain, "Monte Bianco"}, {place, "Alps"}],
[{mountain, "Cerro Torre"}, {place, "Patagonia"}],
Please sign in to comment.
Something went wrong with that request. Please try again.