Commit | Line | Data |
f675c333 |
1 | #!perl -Tw |
2 | |
3 | BEGIN { |
4 | if ( $ENV{PERL_CORE} ) { |
5 | chdir 't'; |
6 | @INC = '../lib'; |
7 | } |
8 | else { |
9 | unshift @INC, 't/lib'; |
10 | } |
11 | } |
12 | |
13 | use strict; |
14 | use Test::More tests => 23; |
15 | |
16 | BEGIN { |
17 | use_ok( 'Test::Harness::Point' ); |
18 | } |
19 | |
20 | BASIC_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 | |
29 | BASIC_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 | |
38 | CRAP: { |
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 | |
46 | PARSE_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 | |
56 | PARSE_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 | } |