Browse Source

prepation for parameterised tests

Anton Lebedevich 13 years ago
parent
commit
752b0f3fe5
1 changed files with 16 additions and 0 deletions
  1. 16 0
      test_src/pgsql_tests.erl

+ 16 - 0
test_src/pgsql_tests.erl

@@ -1,6 +1,7 @@
 -module(pgsql_tests).
 
 -export([run_tests/0]).
+%%-compile([export_all]).
 
 -include_lib("eunit/include/eunit.hrl").
 -include_lib("public_key/include/public_key.hrl").
@@ -573,6 +574,21 @@ run_tests() ->
     Mods = [list_to_atom(filename:basename(F, ".beam")) || F <- Files],
     eunit:test(Mods, []).
 
+all_test_() ->
+    Functions =
+        lists:map(
+          fun({Name, _}) ->
+                  fun(X) -> ?MODULE:Name(X) end
+          end,
+          lists:filter(
+            fun({Name, Arity}) ->
+                    case {lists:suffix("_test", atom_to_list(Name)), Arity} of
+                        {true, 1} -> true;
+                        _ -> false
+                    end
+            end,
+            ?MODULE:module_info(functions))).
+
 %% -- internal functions --
 
 connect_only(Args) ->