1#!perl 2# 3# test apparatus for Text::Template module 4# still incomplete. 5# 6 7use strict; 8use warnings; 9use Test::More tests => 4; 10 11use_ok 'Text::Template' or exit 1; 12 13my $templateIN = q{ 14This line should have a 3: {1+2} 15 16This line should have several numbers: 17{ $t = ''; foreach $n (1 .. 20) { $t .= $n . ' ' } $t } 18}; 19 20my $templateOUT = q{ 21This line should have a 3: { $OUT = 1+2 } 22 23This line should have several numbers: 24{ foreach $n (1 .. 20) { $OUT .= $n . ' ' } } 25}; 26 27# Build templates from string 28my $template = Text::Template->new('type' => 'STRING', 'source' => $templateIN); 29isa_ok $template, 'Text::Template'; 30 31$templateOUT = Text::Template->new('type' => 'STRING', 'source' => $templateOUT); 32isa_ok $templateOUT, 'Text::Template'; 33 34# Fill in templates 35my $text = $template->fill_in(); 36my $textOUT = $templateOUT->fill_in(); 37 38# (1) They should be the same 39is $text, $textOUT; 40 41# Missing: Test this feature in Safe compartments; 42# it's a totally different code path. 43# Decision: Put that into safe.t, because that file should 44# be skipped when Safe.pm is unavailable. 45 46exit; 47