line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
417
|
use Test2::V0; |
|
1
|
|
|
|
|
190263
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
1091
|
use Test2::Tools::Exports; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
429
|
use Test2::Tools::LoadModule; |
|
1
|
|
|
|
|
4049
|
|
|
1
|
|
|
|
|
3
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
744
|
use File::Temp; |
|
1
|
|
|
|
|
15270
|
|
|
1
|
|
|
|
|
55
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
532
|
use Rex::Commands; # for 'set' |
|
1
|
|
|
|
|
58141
|
|
|
1
|
|
|
|
|
8
|
|
10
|
1
|
|
|
1
|
|
1986
|
use Rex::Commands::File; # for the 'template' function |
|
1
|
|
|
|
|
50738
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
71
|
load_module_ok 'Rex::Template::TT', undef, [ ':register' ]; |
|
1
|
|
|
|
|
15450
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
14
|
1
|
|
|
|
|
686
|
imported_ok qw/&template_toolkit/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# embedded templates |
17
|
1
|
|
|
|
|
551
|
is( template( '@hello_template', name => 'world' ), "Hello, world!\n"); |
18
|
1
|
|
|
|
|
1355
|
is( template( '@hi_template', name => 'world' ), "Hi, world!\n"); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
1236
|
my $template; |
21
|
1
|
|
|
|
|
8
|
$template = 'Hello, [% name %]!'; |
22
|
1
|
|
|
|
|
20
|
is( template_toolkit( \$template, { name => 'world' } ), 'Hello, world!'); |
23
|
1
|
|
|
|
|
416
|
is( template( \$template, { name => 'world' } ), 'Hello, world!'); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
1
|
|
|
|
|
1254
|
my $f = File::Temp->new; |
|
1
|
|
|
|
|
34
|
|
27
|
1
|
|
|
|
|
834
|
print $f 'Hello, [% name %]!'; |
28
|
1
|
|
|
|
|
35
|
$f->close; |
29
|
1
|
|
|
|
|
56
|
is( template_toolkit( $f->filename, { name => 'world' } ), 'Hello, world!'); |
30
|
1
|
|
|
|
|
415
|
is( template( $f->filename, { name => 'world' } ), 'Hello, world!'); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# This code does not throw an exception: it warns using Rex::Logger::info |
34
|
|
|
|
|
|
|
# so we need to mock that to check for the expected error! |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
#for my $key in qw(GET CALL SET DEFAULT INSERT INCLUDE PROCESS WRAPPER IF UNLESS |
37
|
|
|
|
|
|
|
# ELSE ELSIF FOR FOREACH WHILE SWITCH CASE USE PLUGIN FILTER MACRO PERL |
38
|
|
|
|
|
|
|
# RAWPERL BLOCK META TRY THROW CATCH FINAL NEXT LAST BREAK RETURN STOP CLEAR |
39
|
|
|
|
|
|
|
# TO STEP AND OR NOT MOD DIV END) { |
40
|
|
|
|
|
|
|
# like( |
41
|
|
|
|
|
|
|
# dies { template( \$template, $key => 1 ) }, |
42
|
|
|
|
|
|
|
# qr/.../, |
43
|
|
|
|
|
|
|
# 'Using a TT keyword as a variable fails' |
44
|
|
|
|
|
|
|
# ); |
45
|
|
|
|
|
|
|
# like( |
46
|
|
|
|
|
|
|
# dies { template_toolkit( \$template, { $key => 1 } ) }, |
47
|
|
|
|
|
|
|
# qr/.../, |
48
|
|
|
|
|
|
|
# 'Using a TT keyword as a variable fails' |
49
|
|
|
|
|
|
|
# ); |
50
|
|
|
|
|
|
|
#} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
1502
|
done_testing; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Straight from the docs: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__DATA__ |