mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Update mustache.erl
This commit is contained in:
parent
2e654513dd
commit
61c564bf72
1 changed files with 19 additions and 7 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue