blob: 02e0b25e875de4fb1871db664c6fda2003c70c81 (
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
40
41
42
43
44
45
46
|
#!perl -Ilib -d:switchd_empty
BEGIN {
$^P = 0x122;
chdir 't';
@INC = ('../lib', 'lib');
require './test.pl';
}
use strict;
use warnings;
no warnings 'redefine';
plan 2;
our @lines;
sub DB::DB {
my ($p, $f, $l) = caller;
return unless $f =~ /^\(eval \d+\)\[.*78586\.t:\d+\]/;
push @lines, $l;
}
sub trace_lines {
my ($src) = @_;
local @lines;
eval $src;
die if $@;
return join " ", @lines;
}
is trace_lines(<<'END'), "1 3 3 5";
++$b;
{
++$b;
}
++$b;
END
is trace_lines(<<'END'), "1 2 3 3 5";
++$b;
for (my $a=1; $a <= 2; ++$a) {
++$b;
}
++$b;
END
|