summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/Test/Simple/t/fail.t
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:15 +0000
commit74cfb115ac810480c0000dc742b20383c1578bac (patch)
tree316d96e5123617976f1637b143570c309a662045 /gnu/usr.bin/perl/lib/Test/Simple/t/fail.t
parent453ade492b8e06c619009d6cd52a85cb04e8cf17 (diff)
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/lib/Test/Simple/t/fail.t')
-rw-r--r--gnu/usr.bin/perl/lib/Test/Simple/t/fail.t69
1 files changed, 69 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/lib/Test/Simple/t/fail.t b/gnu/usr.bin/perl/lib/Test/Simple/t/fail.t
new file mode 100644
index 00000000000..a041ab0eb9b
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/Test/Simple/t/fail.t
@@ -0,0 +1,69 @@
+#!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();
+
+
+# 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++;
+}
+
+
+package main;
+
+require Test::Simple;
+Test::Simple->import(tests => 5);
+
+#line 35
+ok( 1, 'passing' );
+ok( 2, 'passing still' );
+ok( 3, 'still passing' );
+ok( 0, 'oh no!' );
+ok( 0, 'damnit' );
+
+
+END {
+ My::Test::ok($$out eq <<OUT);
+1..5
+ok 1 - passing
+ok 2 - passing still
+ok 3 - still passing
+not ok 4 - oh no!
+not ok 5 - damnit
+OUT
+
+ My::Test::ok($$err eq <<ERR);
+# Failed test ($0 at line 38)
+# Failed test ($0 at line 39)
+# Looks like you failed 2 tests of 5.
+ERR
+
+ # Prevent Test::Simple from exiting with non zero
+ exit 0;
+}