Upgrade to CGI.pm-3.31. Includes version bump to CGI::Carp due to a Pod fix.
[p5sagit/p5-mst-13.2.git] / lib / Test / Harness / t / from_line.t
CommitLineData
f675c333 1#!perl -Tw
2
3BEGIN {
4 if ( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = '../lib';
7 }
8 else {
9 unshift @INC, 't/lib';
10 }
11}
12
13use strict;
14use Test::More tests => 23;
15
16BEGIN {
17 use_ok( 'Test::Harness::Point' );
18}
19
20BASIC_OK: {
21 my $line = "ok 14 - Blah blah";
22 my $point = Test::Harness::Point->from_test_line( $line );
23 isa_ok( $point, 'Test::Harness::Point', 'BASIC_OK' );
24 is( $point->number, 14 );
25 ok( $point->ok );
26 is( $point->description, 'Blah blah' );
27}
28
29BASIC_NOT_OK: {
30 my $line = "not ok 267 Yada";
31 my $point = Test::Harness::Point->from_test_line( $line );
32 isa_ok( $point, 'Test::Harness::Point', 'BASIC_NOT_OK' );
33 is( $point->number, 267 );
34 ok( !$point->ok );
35 is( $point->description, 'Yada' );
36}
37
38CRAP: {
39 my $point = Test::Harness::Point->from_test_line( 'ok14 - Blah' );
40 ok( !defined $point, 'CRAP 1' );
41
42 $point = Test::Harness::Point->from_test_line( 'notok 14' );
43 ok( !defined $point, 'CRAP 2' );
44}
45
46PARSE_TODO: {
47 my $point = Test::Harness::Point->from_test_line( 'not ok 14 - Calculate sqrt(-1) # TODO Still too rational' );
48 isa_ok( $point, 'Test::Harness::Point', 'PARSE_TODO' );
49 is( $point->description, 'Calculate sqrt(-1)' );
50 is( $point->directive_type, 'todo' );
51 is( $point->directive_reason, 'Still too rational' );
52 ok( !$point->is_skip );
53 ok( $point->is_todo );
54}
55
56PARSE_SKIP: {
57 my $point = Test::Harness::Point->from_test_line( 'ok 14 # skip Not on bucket #6' );
58 isa_ok( $point, 'Test::Harness::Point', 'PARSE_SKIP' );
59 is( $point->description, '' );
60 is( $point->directive_type, 'skip' );
61 is( $point->directive_reason, 'Not on bucket #6' );
62 ok( $point->is_skip );
63 ok( !$point->is_todo );
64}