summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey Savenko <deadok22@gmail.com>2013-08-15 12:26:50 +0400
committerSergey Savenko <deadok22@gmail.com>2014-05-29 22:38:14 +0400
commit93689703c1d29d5859b04db4f27d3b19d75873e5 (patch)
tree2291ee80c827b743ba2d80a59f5cd91dda7cb651 /test
parentf47af30e65efeba55d2ac37df071aea080788ac2 (diff)
downloadrebar-93689703c1d29d5859b04db4f27d3b19d75873e5.tar.gz
Add qualified name tests specification (see #118)
Augment 'tests' option of 'rebar eunit' command with ability to specify tests to run using module-qualified names. This change also forced me to change the way modules for coverage and for testing itself are selected - module-qualified tests specifications are now taken into consideration. Extend tests to cover new functionality. Update dialyzer_reference accordingly.
Diffstat (limited to 'test')
-rw-r--r--test/rebar_eunit_tests.erl40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl
index 61a9bbf..bb64507 100644
--- a/test/rebar_eunit_tests.erl
+++ b/test/rebar_eunit_tests.erl
@@ -191,6 +191,46 @@ eunit_with_suites_and_tests_test_() ->
{"Selected suite tests is run once",
?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}]
+ end},
+ {"Ensure EUnit runs a specific test by qualified function name",
+ setup,
+ fun() ->
+ setup_project_with_multiple_modules(),
+ rebar("-v eunit tests=myapp_mymod:myprivate_test")
+ end,
+ fun teardown/1,
+ fun(RebarOut) ->
+ [{"Selected test is run",
+ [?_assert(string:str(RebarOut,
+ "myapp_mymod:myprivate_test/0")
+ =/= 0)]},
+
+ {"Only selected test is run",
+ [?_assert(string:str(RebarOut,
+ "Test passed.") =/= 0)]}]
+ end},
+ {"Ensure EUnit runs a specific test by qualified function "
+ ++ "name and tests from other module",
+ setup,
+ fun() ->
+ setup_project_with_multiple_modules(),
+ rebar("-v eunit suites=myapp_mymod3 "
+ ++ "tests=myapp_mymod:myprivate_test")
+ end,
+ fun teardown/1,
+ fun(RebarOut) ->
+ [{"Selected test is run",
+ [?_assert(string:str(RebarOut,
+ "myapp_mymod:myprivate_test/0") =/= 0)]},
+
+ {"Tests from module are run",
+ [?_assert(string:str(RebarOut,
+ "myapp_mymod3:") =/= 0)]},
+
+ {"Only selected tests are run",
+ [?_assert(string:str(RebarOut,
+ "Failed: 1. Skipped: 0. Passed: 1")
+ =/= 0)]}]
end}].
cover_test_() ->