From: Vincent Pit Date: Fri, 24 Dec 2010 17:49:43 +0000 (+0100) Subject: Fix and test skip() X-Git-Tag: v0.01~21 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=commitdiff_plain;h=05ec570604d429eac0e547d95e6865e8c5751d7b Fix and test skip() --- diff --git a/MANIFEST b/MANIFEST index e5fbf16..d0c4d96 100644 --- a/MANIFEST +++ b/MANIFEST @@ -13,6 +13,7 @@ t/14-use-no_plan.t t/15-use-skip_all.t t/16-done_testing.t t/17-plan-done_testing.t +t/18-skip.t t/19-comments.t t/80-threads.t t/20-ok.t diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index 4f53275..dfba80f 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -183,6 +183,8 @@ sub skip { } for (1 .. $count) { + ++$test; + my $skip_str = "ok $test # skip"; if (defined $reason) { sanitize_comment($reason); @@ -191,8 +193,6 @@ sub skip { local $\; print $TAP_STREAM "$skip_str\n"; - - $test++; } no warnings 'exiting'; diff --git a/t/18-skip.t b/t/18-skip.t new file mode 100644 index 0000000..05fa3ae --- /dev/null +++ b/t/18-skip.t @@ -0,0 +1,26 @@ +#!perl -T + +use strict; +use warnings; + +use Test::Leaner tests => 7; + +pass 'test begin'; + +SKIP: { + skip 'test skipping a block' => 1; + fail 'should not be reached'; +} + +SKIP: { + pass 'outer block begin'; + SKIP: { + skip 'test skipping the inner nested block' => 1; + fail 'should not be reached either'; + } + pass 'back to outer block'; + skip 'test skipping the outer nested block' => 1; + fail 'should not be reached as well'; +} + +pass 'test end';