1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!perl -Tw
BEGIN {
if ( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}
use strict;
use Test::More tests => 11;
BEGIN {
use_ok( 'Test::Harness::Point' );
}
my $point = Test::Harness::Point->new;
isa_ok( $point, 'Test::Harness::Point' );
ok( !$point->ok, "Should start out not OK" );
$point->set_ok( 1 );
ok( $point->ok, "should have turned to true" );
$point->set_ok( 0 );
ok( !$point->ok, "should have turned false" );
$point->set_number( 2112 );
is( $point->number, 2112, "Number is set" );
$point->set_description( "Blah blah" );
is( $point->description, "Blah blah", "Description set" );
$point->set_directive( "Go now" );
is( $point->directive, "Go now", "Directive set" );
$point->add_diagnostic( "# Line 1" );
$point->add_diagnostic( "# Line two" );
$point->add_diagnostic( "# Third line" );
my @diags = $point->diagnostics;
is( @diags, 3, "Three lines" );
is_deeply(
\@diags,
[ "# Line 1", "# Line two", "# Third line" ],
"Diagnostics in list context"
);
my $diagstr = <<EOF;
# Line 1
# Line two
# Third line
EOF
chomp $diagstr;
my $string_diagnostics = $point->diagnostics;
is( $string_diagnostics, $diagstr, "Diagnostics in scalar context" );
|