summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/TTLegacy/depth.t
blob: 53ba7e0779e7a95ae1577b78a51a9d76ca20f672 (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
39
use strict;
use warnings;

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

use Test::Tester;

use MyTest;

my $test = Test::Builder->new;
$test->plan(tests => 2);

sub deeper
{
	MyTest::ok(1);
}

{

	my @results = run_tests(
		sub {
			MyTest::ok(1);
			deeper();
		}
	);

	local $Test::Builder::Level = 0;
	$test->is_num($results[1]->{depth}, 1, "depth 1");
	$test->is_num($results[2]->{depth}, 2, "deeper");
}