Upgrade to Test::Simple 0.53
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / todo.t
1 #!perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = '../lib';
7     }
8 }
9
10 require Test::Harness;
11 use Test::More;
12
13 # This feature requires a fairly new version of Test::Harness
14 (my $th_version = $Test::Harness::VERSION) =~ s/_//; # for X.Y_Z alpha versions
15 if( $th_version < 2.03 ) {
16     plan tests => 1;
17     fail "Need Test::Harness 2.03 or up.  You have $th_version.";
18     exit;
19 }
20
21 plan tests => 16;
22
23
24 $Why = 'Just testing the todo interface.';
25
26 my $is_todo;
27 TODO: {
28     local $TODO = $Why;
29
30     fail("Expected failure");
31     fail("Another expected failure");
32
33     $is_todo = Test::More->builder->todo;
34 }
35
36 pass("This is not todo");
37 ok( $is_todo, 'TB->todo' );
38
39
40 TODO: {
41     local $TODO = $Why;
42
43     fail("Yet another failure");
44 }
45
46 pass("This is still not todo");
47
48
49 TODO: {
50     local $TODO = "testing that error messages don't leak out of todo";
51
52     ok( 'this' eq 'that',   'ok' );
53
54     like( 'this', '/that/', 'like' );
55     is(   'this', 'that',   'is' );
56     isnt( 'this', 'this',   'isnt' );
57
58     can_ok('Fooble', 'yarble');
59     isa_ok('Fooble', 'yarble');
60     use_ok('Fooble');
61     require_ok('Fooble');
62 }
63
64
65 TODO: {
66     todo_skip "Just testing todo_skip", 2;
67
68     fail("Just testing todo");
69     die "todo_skip should prevent this";
70     pass("Again");
71 }