1#!/usr/bin/perl -w 2 3use strict; 4use Test::Builder; 5 6BEGIN { 7 if( $ENV{PERL_CORE} ) { 8 chdir 't'; 9 @INC = ( '../lib', 'lib' ); 10 } 11 else { 12 unshift @INC, 't/lib'; 13 } 14} 15use Test::Builder::NoOutput; 16 17my $tb = Test::Builder->new; 18 19$tb->ok( !eval { $tb->subtest() } ); 20$tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); 21 22$tb->ok( !eval { $tb->subtest("foo") } ); 23$tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); 24 25my $foo; 26$tb->subtest('Arg passing', sub { 27 $foo = shift; 28 $tb->ok(1); 29}, 'foo'); 30 31$tb->is_eq($foo, 'foo'); 32 33$tb->done_testing(); 34