X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=blobdiff_plain;f=t%2F05-pass.t;h=ecc6df18586eacbc49d034bb41a3c727662b80e4;hp=f9997476d7a61a8e70cff64486569293c83d9d52;hb=e63601e117e265834dc41b4001bcacfa73d270df;hpb=9497e7098591c7bbc659406d4ffae555a7b8acc8 diff --git a/t/05-pass.t b/t/05-pass.t index f999747..ecc6df1 100644 --- a/t/05-pass.t +++ b/t/05-pass.t @@ -5,37 +5,27 @@ use warnings; use Test::More; -plan skip_all => 'perl 5.8 required to test pass()' unless $] >= 5.008; +use Test::Leaner (); -my $buf = ''; -open my $memory_stream, '>', \$buf - or plan skip_all => 'could not create the in-memory file'; - -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'; -} +};