summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/subtest/singleton.t
blob: 0c25261f5bb64ea7a523f7235e97936574c79992 (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
35
36
37
38
#!/usr/bin/perl -w

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

use strict;
use warnings;
use Test::More tests => 3;

{

    package Test::Singleton;

    use Test::Builder;
    my $TB = Test::Builder->new;

    sub singleton_ok ($;$) {
        my( $val, $name ) = @_;
        $TB->ok( $val, $name );
    }
}

ok 1, 'TB top level';
subtest 'doing a subtest' => sub {
    plan tests => 4;
    ok 1, 'first test in subtest';
    Test::Singleton::singleton_ok(1, 'this should not fail');
    ok 1, 'second test in subtest';
    Test::Singleton::singleton_ok(1, 'this should not fail');
};
ok 1, 'left subtest';