PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/ucengine/src/core/tests.erl

http://github.com/AF83/ucengine
Erlang | 62 lines | 41 code | 4 blank | 17 comment | 0 complexity | ad3a8c65950d9e57cb9ff025d390c0e1 MD5 | raw file
  1. %%
  2. %% U.C.Engine - Unified Collaboration Engine
  3. %% Copyright (C) 2011 af83
  4. %%
  5. %% This program is free software: you can redistribute it and/or modify
  6. %% it under the terms of the GNU Affero General Public License as published by
  7. %% the Free Software Foundation, either version 3 of the License, or
  8. %% (at your option) any later version.
  9. %%
  10. %% This program is distributed in the hope that it will be useful,
  11. %% but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. %% GNU Affero General Public License for more details.
  14. %%
  15. %% You should have received a copy of the GNU Affero General Public License
  16. %% along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %%
  18. -module(tests).
  19. -include("uce.hrl").
  20. -export([run/0, start/0]).
  21. start() ->
  22. case run() of
  23. error ->
  24. init:stop(2);
  25. ok ->
  26. init:stop(0)
  27. end.
  28. run() ->
  29. Modules = [event_tests,
  30. search_tests,
  31. meeting_tests,
  32. presence_tests,
  33. user_tests,
  34. file_tests,
  35. role_tests,
  36. ctl_tests,
  37. url_tests] ++
  38. case config:get(search) of
  39. solr ->
  40. [solr_tests];
  41. _ ->
  42. []
  43. end,
  44. Failed = lists:filter(fun(Module) ->
  45. io:format("> ~p~n", [Module]),
  46. case Module:test() of
  47. ok ->
  48. false;
  49. error ->
  50. true
  51. end
  52. end, Modules),
  53. if
  54. length(Failed) > 0 ->
  55. error;
  56. true ->
  57. ok
  58. end.