summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/Legacy/subtest/args.t
blob: d43ac5288e0e93fed97ba19615f4a596442f6710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -w

use strict;
use Test::Builder;

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = ( '../lib', 'lib' );
    }
    else {
        unshift @INC, 't/lib';
    }
}
use Test::Builder::NoOutput;

my $tb = Test::Builder->new;

$tb->ok( !eval { $tb->subtest() } );
$tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ );

$tb->ok( !eval { $tb->subtest("foo") } );
$tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ );

use Carp qw/confess/;
$tb->subtest('Arg passing', sub {
    my $foo = shift;
    my $child = Test::Builder->new;
    $child->is_eq($foo, 'foo');
    $child->done_testing;
    $child->finalize;
}, 'foo');

$tb->done_testing();