line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Test::Standalone; |
3
|
|
|
|
|
|
|
########################################### |
4
|
1
|
|
|
1
|
|
42824
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
359694
|
use Filter::Util::Call; |
|
1
|
|
|
|
|
1296
|
|
|
1
|
|
|
|
|
76
|
|
7
|
1
|
|
|
1
|
|
2533
|
use Getopt::Std; |
|
1
|
|
|
|
|
39
|
|
|
1
|
|
|
|
|
393
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $CODE = ""; |
10
|
|
|
|
|
|
|
my $IN_TEST = 0; |
11
|
|
|
|
|
|
|
my $TEST_START = qr(^=begin test); |
12
|
|
|
|
|
|
|
my $TEST_END = qr(^=end test); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
########################################### |
17
|
|
|
|
|
|
|
sub import { |
18
|
|
|
|
|
|
|
########################################### |
19
|
1
|
|
|
1
|
|
11
|
my($type, @arguments) = @_ ; |
20
|
1
|
|
|
|
|
3
|
filter_add([]) ; |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
33
|
|
|
31
|
if(@ARGV and $ARGV[0] eq "--test") { |
23
|
0
|
|
|
|
|
0
|
$IN_TEST = 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
########################################### |
28
|
|
|
|
|
|
|
sub filter { |
29
|
|
|
|
|
|
|
########################################### |
30
|
8
|
|
|
8
|
0
|
3251
|
my $status = filter_read(); |
31
|
8
|
100
|
|
|
|
35
|
if(/$TEST_START/ .. /$TEST_END/) { |
32
|
3
|
100
|
66
|
|
|
21
|
if(!/$TEST_START/ and !/$TEST_END/) { |
33
|
1
|
|
|
|
|
2
|
$CODE .= $_; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
8
|
50
|
|
|
|
18
|
if($IN_TEST) { |
37
|
0
|
0
|
|
|
|
0
|
if( s/^\s*main\s*\(\)/Test::Standalone::test_run()/ ) { |
38
|
0
|
|
|
|
|
0
|
$IN_TEST = 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
8
|
|
|
|
|
1604
|
$status; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
########################################### |
45
|
|
|
|
|
|
|
sub test_run { |
46
|
|
|
|
|
|
|
########################################### |
47
|
0
|
|
|
0
|
0
|
0
|
my $code = "package main; " . |
48
|
|
|
|
|
|
|
Test::Standalone::test_code(); |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
0
|
eval $code or die "eval failed: $!"; |
51
|
0
|
|
|
|
|
0
|
exit 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
########################################### |
55
|
|
|
|
|
|
|
sub test_code { |
56
|
|
|
|
|
|
|
########################################### |
57
|
1
|
|
|
1
|
0
|
11
|
return $CODE; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |