summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/Test/t/fail_one.t
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2009-05-13 17:10:15 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2009-05-13 17:10:15 +0000
commitb7b7ee764574929c71a377cb9852315c97c5b5c4 (patch)
tree9d63294bb809390a9774af5836107e29c470f364 /gnu/usr.bin/perl/lib/Test/t/fail_one.t
parent9841a13319c4f3f371dbdc804ecf88402a8bcd3d (diff)
update Test::Simple to version 0.86
tested in multiple builds on multiple arches by me ok millert@, simon@
Diffstat (limited to 'gnu/usr.bin/perl/lib/Test/t/fail_one.t')
-rw-r--r--gnu/usr.bin/perl/lib/Test/t/fail_one.t62
1 files changed, 62 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/lib/Test/t/fail_one.t b/gnu/usr.bin/perl/lib/Test/t/fail_one.t
new file mode 100644
index 00000000000..46b181d6a10
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/Test/t/fail_one.t
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+
+require Test::Simple::Catch;
+my($out, $err) = Test::Simple::Catch::caught();
+local $ENV{HARNESS_ACTIVE} = 0;
+
+
+# Can't use Test.pm, that's a 5.005 thing.
+package My::Test;
+
+print "1..2\n";
+
+my $test_num = 1;
+# Utility testing functions.
+sub ok ($;$) {
+ my($test, $name) = @_;
+ my $ok = '';
+ $ok .= "not " unless $test;
+ $ok .= "ok $test_num";
+ $ok .= " - $name" if defined $name;
+ $ok .= "\n";
+ print $ok;
+ $test_num++;
+
+ return $test ? 1 : 0;
+}
+
+
+package main;
+
+require Test::Simple;
+Test::Simple->import(tests => 1);
+
+#line 45
+ok(0);
+
+END {
+ My::Test::ok($$out eq <<OUT);
+1..1
+not ok 1
+OUT
+
+ My::Test::ok($$err eq <<ERR) || print $$err;
+# Failed test at $0 line 45.
+# Looks like you failed 1 test of 1.
+ERR
+
+ # Prevent Test::Simple from existing with non-zero
+ exit 0;
+}