PageRenderTime 247ms CodeModel.GetById 121ms app.highlight 13ms RepoModel.GetById 108ms app.codeStats 0ms

/src/ewgi_test.erl

http://github.com/skarab/ewgi
Erlang | 32 lines | 28 code | 4 blank | 0 comment | 1 complexity | f41712ac3a026ca407f5502a57a54d23 MD5 | raw file
 1-module(ewgi_test).
 2
 3-export([test/0]).
 4
 5test() ->
 6    lists:map(fun test_file/1,
 7              [filename:rootname(filename:basename(F))
 8               || F <- filelib:wildcard("ebin/*.beam")]).
 9
10test_file("ewgi_test") ->
11    skip;
12test_file(F) ->
13    case code:ensure_loaded(list_to_atom(F)) of
14        {module, M} ->
15            test_mod(M);
16        _ ->
17            skip
18    end.
19
20test_mod(M) ->
21    case M:module_info() of
22        L when is_list(L) ->
23            Exports = proplists:get_value(exports, L, []),
24            case lists:member({test,0}, Exports) of
25                true ->
26                    M:test();
27                _ ->
28                    ok
29            end;
30        _ ->
31            ok
32    end.