From fa6618f2b410c2b71877c1878dff3a0c8503000c Mon Sep 17 00:00:00 2001
From: Roberto Ostinelli <roberto@ostinelli.net>
Date: Sun, 19 Aug 2012 14:23:06 -0700
Subject: Add experimental tests= filter without eunit suites

---
 test/rebar_eunit_tests.erl | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

(limited to 'test')

diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl
index d70d4b7..bf2428b 100644
--- a/test/rebar_eunit_tests.erl
+++ b/test/rebar_eunit_tests.erl
@@ -138,7 +138,7 @@ eunit_with_suites_and_tests_test_() ->
                {"Selected suite tests are run once",
                 ?_assert(string:str(RebarOut, "All 3 tests passed") =/= 0)}]
       end},
-     {"Ensure EUnit runs specific test in _tests suites",
+     {"Ensure EUnit runs specific test in a _tests suite",
       setup,
       fun() ->
               setup_project_with_multiple_modules(),
@@ -155,6 +155,24 @@ eunit_with_suites_and_tests_test_() ->
 
                {"Selected suite tests is run once",
                 ?_assert(string:str(RebarOut, "Test passed") =/= 0)}]
+      end},
+     {"Ensure EUnit runs a specific test without a specified suite",
+      setup,
+      fun() ->
+              setup_project_with_multiple_modules(),
+              rebar("-v eunit tests=myprivate")
+      end,
+      fun teardown/1,
+      fun(RebarOut) ->
+              [{"Only selected suite tests are found and run",
+                [?_assert(string:str(RebarOut,
+                                     "myapp_mymod:myprivate_test/0") =/= 0),
+                 ?_assert(string:str(RebarOut,
+                                     "myapp_mymod2:myprivate2_test/0")
+                          =/= 0)]},
+
+               {"Selected suite tests is run once",
+                ?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}]
       end}].
 
 cover_test_() ->
-- 
cgit v1.1