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