]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blob - t/05-pass.t
Factor the capturing logic into Test::Leaner::TestHelper
[perl/modules/Test-Leaner.git] / t / 05-pass.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 use Test::Leaner ();
9
10 use lib 't/lib';
11 use Test::Leaner::TestHelper;
12
13 my $buf = '';
14 capture_to_buffer $buf or plan skip_all => 'perl 5.8 required to test pass()';
15
16 plan tests => 4;
17
18 reset_buffer {
19  local $@;
20  eval { Test::Leaner::pass() };
21  is $@,   '',       'pass() does not croak';
22  is $buf, "ok 1\n", 'pass() produces the correct TAP code';
23 };
24
25 reset_buffer {
26  local $@;
27  eval { Test::Leaner::pass('this is a comment') };
28  is $@,   '', 'pass("comment") does not croak';
29  is $buf, "ok 2 - this is a comment\n",
30               'pass("comment") produces the correct TAP code';
31 };