summaryrefslogtreecommitdiff
path: root/lib/Test/Simple/t/output.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Test/Simple/t/output.t')
-rw-r--r--lib/Test/Simple/t/output.t39
1 files changed, 37 insertions, 2 deletions
diff --git a/lib/Test/Simple/t/output.t b/lib/Test/Simple/t/output.t
index 82dea28833..dd051c15a6 100644
--- a/lib/Test/Simple/t/output.t
+++ b/lib/Test/Simple/t/output.t
@@ -3,12 +3,15 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
- @INC = '../lib';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
# Can't use Test.pm, that's a 5.005 thing.
-print "1..3\n";
+print "1..4\n";
my $test_num = 1;
# Utility testing functions.
@@ -21,8 +24,11 @@ sub ok ($;$) {
$ok .= "\n";
print $ok;
$test_num++;
+
+ return $test;
}
+use TieOut;
use Test::Builder;
my $Test = Test::Builder->new();
@@ -55,3 +61,32 @@ close IN;
ok($lines[1] =~ /Hello!/);
unlink('foo');
+
+
+# Ensure stray newline in name escaping works.
+$out = tie *FAKEOUT, 'TieOut';
+$Test->output(\*FAKEOUT);
+$Test->exported_to(__PACKAGE__);
+$Test->no_ending(1);
+$Test->plan(tests => 5);
+
+$Test->ok(1, "ok");
+$Test->ok(1, "ok\n");
+$Test->ok(1, "ok, like\nok");
+$Test->skip("wibble\nmoof");
+$Test->todo_skip("todo\nskip\n");
+
+my $output = $out->read;
+ok( $output eq <<OUTPUT ) || print STDERR $output;
+1..5
+ok 1 - ok
+ok 2 - ok
+#
+ok 3 - ok, like
+# ok
+ok 4 # skip wibble
+# moof
+not ok 5 # TODO & SKIP todo
+# skip
+#
+OUTPUT