Permalink
Browse files

Check that our early returns work okay with test methods than run mor…

…e than one test
  • Loading branch information...
1 parent dd85e66 commit 821b68de577a4388009c5785102a5fd0ad2d7fdb @adrianh committed Apr 17, 2011
Showing with 9 additions and 5 deletions.
  1. +9 −5 t/runtests_return.t
View
@@ -8,9 +8,10 @@ package Foo;
use Test::More;
use base qw(Test::Class);
-sub darwin_only : Test {
+sub darwin_only : Tests(2) {
return("darwin only test");# unless $^O eq "darwin";
- ok(-w "/Library", "/Library writable")
+ ok(-w "/Library", "/Library writable");
+ ok(-r "/Library", "/Library readable");
};
package Bar;
@@ -19,20 +20,23 @@ use base qw(Test::Class);
sub fail_if_returned_early { 1 }
-sub darwin_only : Test {
+sub darwin_only : Tests(2) {
return("darwin only test");# unless $^O eq "darwin";
- ok(-w "/Library", "/Library writable")
+ ok(-r "/Library", "/Library readable");
+ ok(-w "/Library", "/Library writable");
};
package main;
use Test::Builder::Tester tests => 2;
test_out("ok 1 # skip darwin only test");
+test_out("ok 2 # skip darwin only test");
Foo->runtests;
test_test("early return handled (skip)");
-test_out("not ok 1 - (returned before plan complete)");
+test_out("not ok 1 - (Bar::darwin_only returned before plan complete)");
+test_out("not ok 2 - (Bar::darwin_only returned before plan complete)");
test_err(qr/.*in Bar->darwin_only.*/s);
Bar->runtests;
test_test("early return handled (fail)");

0 comments on commit 821b68d

Please sign in to comment.