summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/Test/Harness/t/point.t
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/lib/Test/Harness/t/point.t')
-rwxr-xr-xgnu/usr.bin/perl/lib/Test/Harness/t/point.t58
1 files changed, 58 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/lib/Test/Harness/t/point.t b/gnu/usr.bin/perl/lib/Test/Harness/t/point.t
new file mode 100755
index 00000000000..1c8cf9da737
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/Test/Harness/t/point.t
@@ -0,0 +1,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" );