From 0cd946aa8ca5f84826831f3a54bb81945edfa014 Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Tue, 18 Sep 2001 15:53:48 -0400 Subject: [PATCH] [PATCH] Syncing with Test::Simple 0.19 Date: Tue, 18 Sep 2001 19:53:48 -0400 Message-Id: <20010918195348.M585@blackrider> Subject: [REPATCH] Re: [PATCH lib/Test/More.pm] Stray newline confusing t/TEST From: Michael G Schwern Date: Tue, 18 Sep 2001 22:07:13 -0400 Message-Id: <20010918220713.B19616@blackrider> p4raw-id: //depot/perl@12080 --- lib/Test/More.pm | 4 +++- lib/Test/Simple.pm | 16 +++++++++------- lib/Test/Simple/Changes | 10 ++++++++++ lib/Test/Simple/t/exit.t | 7 +++---- lib/Test/Simple/t/extra.t | 1 + lib/Test/Simple/t/fail-more.t | 2 -- lib/Test/Simple/t/fail.t | 1 + lib/Test/Simple/t/missing.t | 1 + lib/Test/Simple/t/todo.t | 18 +++++++++++++++++- lib/Test/Tutorial.pod | 22 ++++++++++++++++------ 10 files changed, 61 insertions(+), 21 deletions(-) diff --git a/lib/Test/More.pm b/lib/Test/More.pm index 925e48e..92d1d88 100644 --- a/lib/Test/More.pm +++ b/lib/Test/More.pm @@ -14,7 +14,7 @@ BEGIN { require Exporter; use vars qw($VERSION @ISA @EXPORT $TODO); -$VERSION = '0.18'; +$VERSION = '0.19'; @ISA = qw(Exporter); @EXPORT = qw(ok use_ok require_ok is isnt like @@ -567,6 +567,7 @@ USE my $ok = ok( !$@, "use $module;" ); unless( $ok ) { + chomp $@; my_print *TESTERR, <&STDOUT") or _whoa(1, "Can't dup STDOUT!"); -open(*TESTERR, ">&STDERR") or _whoa(1, "Can't dup STDERR!"); +open(*TESTERR, ">&STDOUT") or _whoa(1, "Can't dup STDOUT!"); { my $orig_fh = select TESTOUT; $| = 1; @@ -155,14 +155,15 @@ sub ok ($;$) { $Num_Tests++; - my_print *TESTERR, <catdir('lib', 'Test', 'Simple', 'sample_tests'); - +my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests)); while( my($test_name, $exit_codes) = each %Tests ) { my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0]; my $file = File::Spec->catfile($lib, $test_name); - my $wait_stat = system(qq{$^X -"I../lib" -"I../t/lib" $file}); my $actual_exit = $wait_stat >> 8; diff --git a/lib/Test/Simple/t/extra.t b/lib/Test/Simple/t/extra.t index 9d54894..e01240a 100644 --- a/lib/Test/Simple/t/extra.t +++ b/lib/Test/Simple/t/extra.t @@ -32,6 +32,7 @@ my($out, $err) = Test::Simple::Catch::caught(); Test::Simple->import(tests => 3); +#line 30 ok(1, 'Foo'); ok(0, 'Bar'); ok(1, 'Yar'); diff --git a/lib/Test/Simple/t/fail-more.t b/lib/Test/Simple/t/fail-more.t index 6a85e2c..c8b0b59 100644 --- a/lib/Test/Simple/t/fail-more.t +++ b/lib/Test/Simple/t/fail-more.t @@ -95,11 +95,9 @@ ERR # Failed test \\($filename at line 43\\) # Tried to use 'Hooble::mooble::yooble'. # Error: Can't locate Hooble.* in \\\@INC .* - # Failed test \\($filename at line 44\\) # Tried to require 'ALL::YOUR::BASE::ARE::BELONG::TO::US::wibble'. # Error: Can't locate ALL.* in \\\@INC .* - # Looks like you failed 10 tests of 10. ERR diff --git a/lib/Test/Simple/t/fail.t b/lib/Test/Simple/t/fail.t index c101a71..d4be3f0 100644 --- a/lib/Test/Simple/t/fail.t +++ b/lib/Test/Simple/t/fail.t @@ -34,6 +34,7 @@ my($out, $err) = Test::Simple::Catch::caught(); Test::Simple->import(tests => 5); +#line 32 ok( 1, 'passing' ); ok( 2, 'passing still' ); ok( 3, 'still passing' ); diff --git a/lib/Test/Simple/t/missing.t b/lib/Test/Simple/t/missing.t index 7e64d23..21235a9 100644 --- a/lib/Test/Simple/t/missing.t +++ b/lib/Test/Simple/t/missing.t @@ -33,6 +33,7 @@ my($out, $err) = Test::Simple::Catch::caught(); Test::Simple->import(tests => 5); +#line 30 ok(1, 'Foo'); ok(0, 'Bar'); diff --git a/lib/Test/Simple/t/todo.t b/lib/Test/Simple/t/todo.t index 399aa47..70ef083 100644 --- a/lib/Test/Simple/t/todo.t +++ b/lib/Test/Simple/t/todo.t @@ -6,7 +6,7 @@ BEGIN { Test::More->import(skip_all => 'Need the new Test::Harness'); } else { - Test::More->import(tests => 5); + Test::More->import(tests => 13); } } @@ -30,3 +30,19 @@ TODO: { } pass("This is still not todo"); + + +TODO: { + local $TODO = "testing that error messages don't leak out of todo"; + + ok( 'this' eq 'that', 'ok' ); + + like( 'this', '/that/', 'like' ); + is( 'this', 'that', 'is' ); + isnt( 'this', 'this', 'isnt' ); + + can_ok('Fooble', 'yarble'); + isa_ok('Fooble', 'yarble'); + use_ok('Fooble'); + require_ok('Fooble'); +} diff --git a/lib/Test/Tutorial.pod b/lib/Test/Tutorial.pod index 86735ff..38f1f70 100644 --- a/lib/Test/Tutorial.pod +++ b/lib/Test/Tutorial.pod @@ -4,16 +4,26 @@ Test::Tutorial - A tutorial about writing really basic tests =head1 DESCRIPTION - AHHHHHHH!!!! NOT B! Anything but testing! - Beat me, whip me, send me to I, but don't make - me write tests! - *sob* +B + +B<*sob*> + +B - Besides, I don't know how to write the damned things. Is this you? Is writing tests right up there with writing -documentation and having your fingernails pulled out? +documentation and having your fingernails pulled out? Did you open up +a test and read + + ######## We start with some black magic + +and decide that's quite enough for you? + +It's ok. That's all gone now. We've done all the black magic for +you. And here are the tricks... =head2 Nuts and bolts of testing. -- 1.8.3.1