t/test60-subname.p

filter: Statementstmt 95.0% 19 / 20 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 92.0% 23 / 25 CC 1 SCAR 0.0
CC
1
Cov
91%
BEGIN
1.0
will_die
1.0
launch
1.0
CRAP 1.0
« t/test14.pm ↑ Summary t/test17-goto.p »
1 # test sub name resolution
2 16 ▶use Devel::NYTProf::Test qw(example_xsub);
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # call XS sub directly
5 16 Devel::NYTProf::Test::example_xsub("foo");
6  
7 # call XS sub imported into main
8 # (should still be reported as a call to Devel::NYTProf::Test::example_xsub)
9 16 example_xsub("foo");
10  
11 # call XS sub as a method (ignore the extra arg)
12 16 Devel::NYTProf::Test->example_xsub();
13  
14 # call XS sub as a method via subclass (ignore the extra arg)
15 16 @Subclass::ISA = qw(Devel::NYTProf::Test);
16 16 Subclass->example_xsub();
17  
18 16 my $subname = "Devel::NYTProf::Test::example_xsub";
19 16 &$subname("foo");
20  
21 # return from xsub call via an exception
22 # should correctly record the name of the xsub
23 16 ▶sub will_die { die "foo\n" }
Subroutine will_die: called CC=1 SCAR=0.0
24 0 eval { example_xsub(0, \&will_die); 1; };
25 16 ▶warn "\$@ was not the expected 'foo': $@" if $@ ne "foo\n";
Branch: 1 branch
BranchTrueFalseTotal
if $@ ne "foo\n" 0 16 16
26  
27 # goto &$sub
28 16 ▶sub launch { goto &$subname }
Subroutine launch: called CC=1 SCAR=0.0
29 16 launch("foo");
30  
31 # call builtin
32 16 wait();
33  
34 # call builtin that exits via an exception
35 16 eval { open my $f, '<&', 'nonesuch' }; # $@ "Bad filehandle: nonesuch"
« t/test14.pm ↑ Summary t/test17-goto.p »