anchor.diff:      end.
   
   
  -test_render(File, Module, RenderStatus, Vars) ->   
  +test_render(Name, Module) ->
  +    File = filename:join([templates_docroot(), Name]),
  +    {RenderStatus, Vars} = setup(Name),
       case catch Module:render(Vars) of
           {ok, Data} ->
               io:format("rendering~n"), 
  
positive.code: %% API
  -export([run_tests/0, run_test/1]).
  
  %% @spec (Name::string()) -> {CompileStatus::atom(), PresetVars::list(), 
  %%     RenderStatus::atom(), RenderVars::list()} | skip
  %% @doc
  %% @end 
  %%--------------------------------------------------------------------
  setup("autoescape") ->
      CompileVars = [],
      RenderVars = [{var1, "<b>bold</b>"}],
      {ok, CompileVars, ok, RenderVars};  
  setup("comment") ->
      CompileVars = [],
      RenderVars =[],
      {ok, CompileVars, ok, RenderVars};   
  setup("extends") ->
      CompileVars = [],
      RenderVars = [{base_var, "base-barstring"}, {test_var, "test-barstring"}],
      {ok, CompileVars, ok, RenderVars};
  setup("filters") ->
      CompileVars = [],
      RenderVars = [
          {date_var1, {1975,7,24}},
          {datetime_var1, {{1975,7,24}, {7,13,1}}},
          {'list', ["eins", "zwei", "drei"]}
      ],
      {ok, CompileVars, ok, RenderVars};
  setup("for") ->
      CompileVars = [],
      RenderVars = [{fruit_list, ["apple", "banana", "coconut"]}],
      {ok, CompileVars, ok, RenderVars};
  setup("for_list") ->
      CompileVars = [],
      RenderVars = [{fruit_list, [["apple", "apples", "$1"], ["banana", "bananas", "$2"], ["coconut", "coconuts", "$500"]]}],
      {ok, CompileVars, ok, RenderVars};
  setup("for_tuple") ->
      CompileVars = [],
      RenderVars = [{fruit_list, [{"apple", "apples"}, {"banana", "bananas"}, {"coconut", "coconuts"}]}],
      {ok, CompileVars, ok, RenderVars};
  setup("for_list_preset") ->
      CompileVars = [{fruit_list, [["apple", "apples"], ["banana", "bananas"], ["coconut", "coconuts"]]}],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars};
  setup("for_preset") ->
      CompileVars = [{fruit_list, ["preset-apple", "preset-banana", "preset-coconut"]}],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars};
  setup("for_records") ->
      CompileVars = [],
      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, CompileVars, ok, RenderVars};  
  setup("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]}], 
      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, CompileVars, ok, RenderVars};
  setup("include") ->
      CompileVars = [],
      RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}],
      {ok, CompileVars, ok, RenderVars};
  setup("if") ->
      CompileVars = [],
      RenderVars = [{var1, "something"}],
      {ok, CompileVars, ok, RenderVars}; 
  setup("if_preset") ->
      CompileVars = [{var1, "something"}],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars};   
  setup("ifequal") ->
      CompileVars = [],
      RenderVars = [{var1, "foo"}, {var2, "foo"}, {var3, "bar"}],
      {ok, CompileVars, ok, RenderVars};      
  setup("ifequal_preset") ->
      CompileVars = [{var1, "foo"}, {var2, "foo"}],
      RenderVars = [{var3, "bar"}],
      {ok, CompileVars, ok, RenderVars};   
  setup("ifnotequal") ->
      CompileVars = [],
      RenderVars = [{var1, "foo"}, {var2, "foo"}, {var3, "bar"}],
      {ok, CompileVars, ok, RenderVars};        
  setup("ifnotequal_preset") ->
      CompileVars = [{var1, "foo"}, {var2, "foo"}],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars}; 
  setup("now") ->
      CompileVars = [],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars}; 
  setup("var") ->
      CompileVars = [],
      RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}, {var_not_used, "foostring3"}],
      {ok, CompileVars, ok, RenderVars};
  setup("var_preset") ->
      CompileVars = [{preset_var1, "preset-var1"}, {preset_var2, "preset-var2"}],
      RenderVars = [{var1, "foostring1"}, {var2, "foostring2"}],
      {ok, CompileVars, ok, RenderVars}; 
  setup("var_error") ->
      CompileVars = [],
      RenderVars = [{var1, "foostring1"}],   
      {ok, CompileVars, error, RenderVars};
  setup("cycle") ->
      CompileVars = [],
      RenderVars = [{test, [integer_to_list(X) || X <- lists:seq(1, 20)]},
                    {a, "Apple"}, {b, "Banana"}, {c, "Cherry"}],
      {ok, CompileVars, ok, RenderVars};
  %%--------------------------------------------------------------------       
  %% Custom tags
  %%--------------------------------------------------------------------
  setup("custom_tag") ->
      CompileVars  = [],
      RenderVars = [],
      {ok, CompileVars, ok, RenderVars};        
  setup("custom_tag_error") ->
      CompileVars  = [],
      RenderVars = [],
      {error, CompileVars, skip, RenderVars};        
  setup("custom_call") ->
      CompileVars  = [],
      RenderVars = [{var1, "something"}],
      {ok, CompileVars, ok, RenderVars};    
  %%--------------------------------------------------------------------       
  %% Files to ignore:
  %%-------------------------------------------------------------------- 
  setup("base") ->
      %% example base template used in the extends tag
      skip; 
  setup("include.html") ->
      %% example plain text file used in include tag 
      skip;      
  setup(_) ->
      undefined.
      
  
  run_tests() ->    
  
negative.code: %%====================================================================
  
  fold_tests() ->
      lists:foldl(fun(Name, {AccCount, AccErrs}) ->
                  case test_compile_render(Name) of
                      ok -> 
                          {AccCount + 1, AccErrs};
                      {error, Reason} -> 
                          {AccCount + 1, [{Name, Reason} | AccErrs]}
                  end
          end, {0, []}, test_list()
      ).
  
  test_compile_render(Name) ->  
      File = filename:join([templates_docroot(), Name]),
      Module = "example_" ++ Name,
      case setup_compile(Name) of
          {CompileStatus, CompileVars} ->
              Options = [
                  {vars, CompileVars}, 
                  {force_recompile, true}],
  