line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
371
|
use Test2::V0; |
|
1
|
|
|
|
|
196038
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
1192
|
use Test2::Tools::Exports; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
5
|
1
|
|
|
1
|
|
432
|
use Test2::Tools::LoadModule; |
|
1
|
|
|
|
|
4293
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
838
|
use File::Temp; |
|
1
|
|
|
|
|
16320
|
|
|
1
|
|
|
|
|
88
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
495
|
use Rex::Commands; # for 'set' |
|
1
|
|
|
|
|
59905
|
|
|
1
|
|
|
|
|
12
|
|
10
|
1
|
|
|
1
|
|
2217
|
use Rex::Commands::File; # for the 'template' function |
|
1
|
|
|
|
|
52852
|
|
|
1
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
75
|
load_module_ok 'Rex::Template::TT'; |
|
1
|
|
|
|
|
16276
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
14
|
1
|
|
|
|
|
697
|
imported_ok qw/&template_toolkit/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# embedded templates use the default engine when our engine isn't registered |
18
|
1
|
|
|
|
|
598
|
is( template( '@hello_template', name => 'world' ), "Hello, world!"); |
19
|
1
|
|
|
|
|
434139
|
is( template( '@hi_template', name => 'world' ), "Hi, world!"); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
491415
|
my $template; |
22
|
1
|
|
|
|
|
8
|
$template = 'Hello, [% name %]!'; |
23
|
1
|
|
|
|
|
28
|
is( template_toolkit( \$template, { name => 'world' } ), 'Hello, world!'); |
24
|
1
|
|
|
|
|
647
|
is( template( \$template, { name => 'world' } ), 'Hello, [% name %]!'); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
{ |
27
|
1
|
|
|
|
|
371766
|
my $f = File::Temp->new; |
|
1
|
|
|
|
|
41
|
|
28
|
1
|
|
|
|
|
967
|
print $f 'Hello, [% name %]!'; |
29
|
1
|
|
|
|
|
49
|
$f->close; |
30
|
1
|
|
|
|
|
69
|
is( template_toolkit( $f->filename, { name => 'world' } ), 'Hello, world!'); |
31
|
1
|
|
|
|
|
688
|
is( template( $f->filename, { name => 'world' } ), 'Hello, [% name %]!'); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# This code does not throw an exception: it warns using Rex::Logger::info |
35
|
|
|
|
|
|
|
# so we need to mock that to check for the expected error! |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
#for my $key in qw(GET CALL SET DEFAULT INSERT INCLUDE PROCESS WRAPPER IF UNLESS |
38
|
|
|
|
|
|
|
# ELSE ELSIF FOR FOREACH WHILE SWITCH CASE USE PLUGIN FILTER MACRO PERL |
39
|
|
|
|
|
|
|
# RAWPERL BLOCK META TRY THROW CATCH FINAL NEXT LAST BREAK RETURN STOP CLEAR |
40
|
|
|
|
|
|
|
# TO STEP AND OR NOT MOD DIV END) { |
41
|
|
|
|
|
|
|
# like( |
42
|
|
|
|
|
|
|
# dies { template_toolkit( \$template, { $key => 1 } ) }, |
43
|
|
|
|
|
|
|
# qr/.../, |
44
|
|
|
|
|
|
|
# 'Using a TT keyword as a variable fails' |
45
|
|
|
|
|
|
|
# ); |
46
|
|
|
|
|
|
|
#} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
414613
|
done_testing; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Straight from the docs: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__DATA__ |