X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=blobdiff_plain;f=t%2F05-pass.t;h=8c1cb9884baf20d63cc3f33b73b4d4344f9030da;hp=f9997476d7a61a8e70cff64486569293c83d9d52;hb=653bd706f7c17c61e34d98e6fcaed75861b2f7d7;hpb=c80a21dbcb4445fe4aebe276d439d2a2d8b310b1 diff --git a/t/05-pass.t b/t/05-pass.t index f999747..8c1cb98 100644 --- a/t/05-pass.t +++ b/t/05-pass.t @@ -5,37 +5,29 @@ use warnings; use Test::More; -plan skip_all => 'perl 5.8 required to test pass()' 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 (); -plan tests => 5; +use lib 't/lib'; +use Test::Leaner::TestHelper; -require Test::Leaner; +my $buf = ''; +capture_to_buffer $buf or plan skip_all => 'perl 5.8 required to test pass()'; -{ - 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::pass() }; is $@, '', 'pass() does not croak'; is $buf, "ok 1\n", 'pass() produces the correct TAP code'; -} +}; -{ +reset_buffer { local $@; - $buf = ''; - seek $memory_stream, 0, 0; eval { Test::Leaner::pass('this is a comment') }; is $@, '', 'pass("comment") does not croak'; is $buf, "ok 2 - this is a comment\n", 'pass("comment") produces the correct TAP code'; -} +};