Update mustache.erl

This commit is contained in:
Tuncer Ayaz 2011-04-27 10:19:34 +02:00
parent 2e654513dd
commit 61c564bf72

View file

@ -31,6 +31,10 @@
section_re = undefined,
tag_re = undefined}).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
compile(Body) when is_list(Body) ->
State = #mstate{},
CompiledTemplate = pre_compile(Body, State),
@ -215,3 +219,11 @@ start([T]) ->
Out = render(list_to_atom(T)),
io:format(Out ++ "~n", []).
-ifdef(TEST).
simple_test() ->
Ctx = dict:from_list([{name, "world"}]),
Result = render("Hello {{name}}!", Ctx),
?assertEqual("Hello world!", Result).
-endif.