From 83af9a01292b5324de651ed90199f61be8d9eae7 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 20 Aug 2008 14:18:05 +0000 Subject: add missing files git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@687339 13f79535-47bb-0310-9956-ffa450edef68 --- test/runner.erl | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/runner.erl (limited to 'test/runner.erl') diff --git a/test/runner.erl b/test/runner.erl new file mode 100644 index 00000000..5cf559f3 --- /dev/null +++ b/test/runner.erl @@ -0,0 +1,67 @@ +-module(runner). + +-export([run/0]). +-include("couch_config_test.erl"). +-include("couch_config_writer_test.erl"). + +%% Test Runner +run() -> + % mochiweb tests + % case mochiweb:test() of + % ok -> + % io:format("Mochiweb Tests PASSED~n"); + % _ -> + % io:format("Mochiweb Tests FAILED~n") + % end, + + % CouchDB tests + Tests = lists:flatten([ + couch_config_test(), + couch_config_writer_test() + ]), + run_tests(Tests), + + % we're done, get out of here + halt(). + +run_test(TestFun) -> + io:format(" ~s ", [proplists:get_value( + name, + erlang:fun_info(TestFun))]), + try TestFun() of + _ -> + io:format("[PASSED]~n", []), + passed + catch + _:{skipped, Reason} -> + io:format("[SKIPPED]~n", []), + io:format(" reason: ~s~n", [Reason]), + skipped; + _:X -> + io:format("[FAILED]~n", []), + io:format("ERROR: ~n======~n~p ~n======~n~n", + [{X, erlang:get_stacktrace()}]), + failed + end. + +run_tests(List) -> + io:format("Running ~p tests...~n", [lists:flatlength(List)]), + + Results = lists:map(fun run_test/1, List), + + Passed = lists:filter( + fun (Result) -> Result =:= passed end, + Results), + + Failed = lists:filter( + fun (Result) -> Result =:= failed end, + Results), + + Skipped = lists:filter( + fun(Result) -> Result =:= skipped end, + Results), + + io:format("PASSED: ~p, FAILED: ~p, SKIPPED: ~p ~n", + [lists:flatlength(Passed), + lists:flatlength(Failed), + lists:flatlength(Skipped)]). -- cgit v1.2.3