2 # $Id: /mirror/googlecode/test-more/t/skip.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $
5 if( $ENV{PERL_CORE} ) {
11 use Test::More tests => 17;
13 # If we skip with the same name, Test::Harness will report it back and
14 # we won't get lots of false bug reports.
15 my $Why = "Just testing the skip interface.";
19 unless Pigs->can('fly');
24 ok( $pig->altitude > 0, 'Pig is airborne' );
25 ok( $pig->airspeed > 0, ' and moving' );
30 skip "We're not skipping", 2 if 0;
32 pass("Inside skip block");
33 pass("Another inside");
38 skip "Again, not skipping", 2 if 0;
40 my($pack, $file, $line) = caller;
41 is( $pack || '', '', 'calling package not interfered with' );
42 is( $file || '', '', ' or file' );
43 is( $line || '', '', ' or line' );
50 die "A horrible death";
51 fail("Deliberate failure");
58 local $SIG{__WARN__} = sub { $warning = join "", @_ };
60 # perl gets the line number a little wrong on the first
61 # statement inside a block.
65 fail("So very failed");
67 is( $warning, "skip() needs to know \$how_many tests are in the ".
68 "block at $0 line 56\n",
69 'skip without $how_many warning' );
74 skip "Not skipping here.", 4 if 0;
76 pass("This is supposed to run");
78 # Testing out nested skips.
82 fail("You're a failure");
85 pass("This is supposed to run, too");
90 local $SIG{__WARN__} = sub { $warning .= join "", @_ };
93 skip 1, "This is backwards" if 1;
95 pass "This does not run";
98 like $warning, '/^skip\(\) was passed a non-numeric number of tests/';