Port couch_replicator/01-load.t etap test suite to eunit
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1bc015a5 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1bc015a5 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1bc015a5 Branch: refs/heads/1.x.x Commit: 1bc015a5fcdcc1d4b355c5b778b1d066dad670ec Parents: e3ab316 Author: Alexander Shorin <[email protected]> Authored: Thu Jun 12 02:47:15 2014 +0400 Committer: Alexander Shorin <[email protected]> Committed: Thu Dec 3 00:52:10 2015 +0300 ---------------------------------------------------------------------- src/couch_replicator/Makefile.am | 2 +- src/couch_replicator/test/01-load.t | 37 ------------------ .../couch_replicator_modules_load_tests.erl | 40 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/1bc015a5/src/couch_replicator/Makefile.am ---------------------------------------------------------------------- diff --git a/src/couch_replicator/Makefile.am b/src/couch_replicator/Makefile.am index 2dcd47d..4f0aab2 100644 --- a/src/couch_replicator/Makefile.am +++ b/src/couch_replicator/Makefile.am @@ -36,7 +36,7 @@ source_files = \ src/couch_replicator.erl test_files = \ - test/01-load.t \ + test/couch_replicator_modules_load_tests.erl \ test/02-httpc-pool.t \ test/03-replication-compact.t \ test/04-replication-large-atts.t \ http://git-wip-us.apache.org/repos/asf/couchdb/blob/1bc015a5/src/couch_replicator/test/01-load.t ---------------------------------------------------------------------- diff --git a/src/couch_replicator/test/01-load.t b/src/couch_replicator/test/01-load.t deleted file mode 100644 index 8bd82dd..0000000 --- a/src/couch_replicator/test/01-load.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env escript -%% -*- erlang -*- - -% Licensed under the Apache License, Version 2.0 (the "License"); you may not -% use this file except in compliance with the License. You may obtain a copy of -% the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -% License for the specific language governing permissions and limitations under -% the License. - -% Test that we can load each module. - -main(_) -> - test_util:init_code_path(), - Modules = [ - couch_replicator_api_wrap, - couch_replicator_httpc, - couch_replicator_httpd, - couch_replicator_manager, - couch_replicator_notifier, - couch_replicator, - couch_replicator_worker, - couch_replicator_utils, - couch_replicator_job_sup - ], - - etap:plan(length(Modules)), - lists:foreach( - fun(Module) -> - etap:loaded_ok(Module, lists:concat(["Loaded: ", Module])) - end, Modules), - etap:end_tests(). http://git-wip-us.apache.org/repos/asf/couchdb/blob/1bc015a5/src/couch_replicator/test/couch_replicator_modules_load_tests.erl ---------------------------------------------------------------------- diff --git a/src/couch_replicator/test/couch_replicator_modules_load_tests.erl b/src/couch_replicator/test/couch_replicator_modules_load_tests.erl new file mode 100644 index 0000000..7107b9e --- /dev/null +++ b/src/couch_replicator/test/couch_replicator_modules_load_tests.erl @@ -0,0 +1,40 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + +-module(couch_replicator_modules_load_tests). + +-include("couch_eunit.hrl"). + + +modules_load_test_() -> + { + "Verify that all modules loads", + should_load_modules() + }. + + +should_load_modules() -> + Modules = [ + couch_replicator_api_wrap, + couch_replicator_httpc, + couch_replicator_httpd, + couch_replicator_manager, + couch_replicator_notifier, + couch_replicator, + couch_replicator_worker, + couch_replicator_utils, + couch_replicator_job_sup + ], + [should_load_module(Mod) || Mod <- Modules]. + +should_load_module(Mod) -> + {atom_to_list(Mod), ?_assertMatch({module, _}, code:load_file(Mod))}.
