Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 22298f62b9
Fetching contributors…

Cannot retrieve contributors at this time

executable file 27 lines (22 sloc) 0.964 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/usr/local/lib/erlang/erts-5.7.4/bin/escript
%% -*- erlang -*-

-mode(compile).

main([]) ->
    CWD = filename:absname(""),
    Root = CWD ++ "/../tests/markdownsharp/",
    Dirs = ["mdtest-1.1", "mstest-0.1", "php-markdown"],
    Files = lists:merge(make_file_lists(Dirs, Root, [])),
    Tests = read_files(Files, []),
    File = CWD ++ "/../tests/markdownsharp.tests",
    {ok, FileHandle} = file:open(File, [append]),
    write_tests(FileHandle, Tests).

write_tests(FileHandle, []) -> file:close(FileHandle);
write_tests(FileHandle, [H | T]) -> io:fwrite(FileHandle, "~p,~n", [H]),
                                    write_tests(FileHandle, T).
        
make_file_lists(Dirs, Root, []) ->
    [filelib:wildcard(Root ++ X ++ "/*") || X <- Dirs].

read_files([], Acc) -> Acc;
read_files([H | T], Acc) ->
    {ok, Bin} = file:read_file(H),
    io:format("H is ~p~nTest is ~p~n", [H, binary_to_list(Bin)]),
    read_files(T, [binary_to_list(Bin) | Acc]).
Something went wrong with that request. Please try again.