X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=blobdiff_plain;f=t%2F06-fail.t;h=08d0f13496f52e569bd950610337ba4bb77f03cd;hp=a3ed9e0c6c8ef3a8ffdc89ce79cbc031d513d30a;hb=653bd706f7c17c61e34d98e6fcaed75861b2f7d7;hpb=c80a21dbcb4445fe4aebe276d439d2a2d8b310b1 diff --git a/t/06-fail.t b/t/06-fail.t index a3ed9e0..08d0f13 100644 --- a/t/06-fail.t +++ b/t/06-fail.t @@ -5,37 +5,30 @@ use warnings; use Test::More; -plan skip_all => 'perl 5.8 required to test fail()' unless $] >= 5.008; +BEGIN { delete $ENV{PERL_TEST_LEANER_USES_TEST_MORE} } -my $buf = ''; -open my $memory_stream, '>', \$buf - or plan skip_all => 'could not create the in-memory file'; +use Test::Leaner (); + +use lib 't/lib'; +use Test::Leaner::TestHelper; -plan tests => 5; +my $buf = ''; +capture_to_buffer $buf or plan skip_all => 'perl 5.8 required to test fail()'; -require Test::Leaner; -{ - local $@; - eval { Test::Leaner::tap_stream($memory_stream) }; - is $@, '', 'tap_stream($fh) does not croak'; -} +plan tests => 4; -{ +reset_buffer { local $@; - $buf = ''; - seek $memory_stream, 0, 0; eval { Test::Leaner::fail() }; is $@, '', 'fail() does not croak'; is $buf, "not ok 1\n", 'fail() produces the correct TAP code'; -} +}; -{ +reset_buffer { local $@; - $buf = ''; - seek $memory_stream, 0, 0; eval { Test::Leaner::fail('this is a comment') }; is $@, '', 'fail("comment") does not croak'; is $buf, "not ok 2 - this is a comment\n", 'fail("comment") produces the correct TAP code'; -} +};