Commit | Line | Data |
33459055 |
1 | #!perl -w |
2 | |
d020a79a |
3 | BEGIN { |
a9153838 |
4 | if( $ENV{PERL_CORE} ) { |
5 | chdir 't'; |
6 | @INC = '../lib'; |
7 | } |
33459055 |
8 | } |
9 | |
30e302f8 |
10 | use Test::More; |
11 | |
0257f296 |
12 | plan tests => 18; |
30e302f8 |
13 | |
14 | |
d020a79a |
15 | $Why = 'Just testing the todo interface.'; |
16 | |
7483b81c |
17 | my $is_todo; |
d020a79a |
18 | TODO: { |
19 | local $TODO = $Why; |
20 | |
21 | fail("Expected failure"); |
22 | fail("Another expected failure"); |
d020a79a |
23 | |
7483b81c |
24 | $is_todo = Test::More->builder->todo; |
25 | } |
d020a79a |
26 | |
27 | pass("This is not todo"); |
7483b81c |
28 | ok( $is_todo, 'TB->todo' ); |
d020a79a |
29 | |
30 | |
31 | TODO: { |
32 | local $TODO = $Why; |
33 | |
34 | fail("Yet another failure"); |
35 | } |
36 | |
37 | pass("This is still not todo"); |
0cd946aa |
38 | |
39 | |
40 | TODO: { |
41 | local $TODO = "testing that error messages don't leak out of todo"; |
42 | |
43 | ok( 'this' eq 'that', 'ok' ); |
44 | |
45 | like( 'this', '/that/', 'like' ); |
46 | is( 'this', 'that', 'is' ); |
47 | isnt( 'this', 'this', 'isnt' ); |
48 | |
49 | can_ok('Fooble', 'yarble'); |
50 | isa_ok('Fooble', 'yarble'); |
51 | use_ok('Fooble'); |
52 | require_ok('Fooble'); |
53 | } |
a9153838 |
54 | |
55 | |
56 | TODO: { |
57 | todo_skip "Just testing todo_skip", 2; |
58 | |
59 | fail("Just testing todo"); |
60 | die "todo_skip should prevent this"; |
61 | pass("Again"); |
62 | } |
0257f296 |
63 | |
64 | |
65 | { |
66 | my $warning; |
67 | local $SIG{__WARN__} = sub { $warning = join "", @_ }; |
68 | TODO: { |
69 | # perl gets the line number a little wrong on the first |
70 | # statement inside a block. |
71 | 1 == 1; |
72 | #line 82 |
73 | todo_skip "Just testing todo_skip"; |
74 | fail("So very failed"); |
75 | } |
76 | is( $warning, "todo_skip() needs to know \$how_many tests are in the ". |
77 | "block at $0 line 82\n", |
78 | 'todo_skip without $how_many warning' ); |
79 | } |