1#!/usr/bin/perl -w 2 3BEGIN { 4 if( $ENV{PERL_CORE} ) { 5 chdir 't'; 6 @INC = ( '../lib', 'lib' ); 7 } 8 else { 9 unshift @INC, 't/lib'; 10 } 11} 12 13use strict; 14use warnings; 15use Test::More tests => 3; 16 17{ 18 19 package Test::Singleton; 20 21 use Test::Builder; 22 my $TB = Test::Builder->new; 23 24 sub singleton_ok ($;$) { 25 my( $val, $name ) = @_; 26 $TB->ok( $val, $name ); 27 } 28} 29 30ok 1, 'TB top level'; 31subtest 'doing a subtest' => sub { 32 plan tests => 4; 33 ok 1, 'first test in subtest'; 34 Test::Singleton::singleton_ok(1, 'this should not fail'); 35 ok 1, 'second test in subtest'; 36 Test::Singleton::singleton_ok(1, 'this should not fail'); 37}; 38ok 1, 'left subtest'; 39