/home/.cpan/build/Text-Template-1.61-0/t
NameSizeModeActions
author-pod-syntax.t3000644editdlrm
author-signature.t4310644editdlrm
basic.t53140755editdlrm
broken.t16110755editdlrm
delimiters.t28030755editdlrm
error.t8080755editdlrm
exported.t18610755editdlrm
hash.t26820755editdlrm
inline-comment.t3220755editdlrm
nested-tags.t5660755editdlrm
ofh.t6650755editdlrm
out.t10860755editdlrm
prepend.t19270755editdlrm
preprocess.t12850755editdlrm
rt29928.t5530755editdlrm
safe.t38320755editdlrm
safe2.t25680755editdlrm
safe3.t19350755editdlrm
strict.t12640755editdlrm
taint.t34310750editdlrm
template-encoding.t9440755editdlrm
warnings.t12820755editdlrm
Edit: /home/.cpan/build/Text-Template-1.61-0/t/preprocess.t (1285B)
#!perl # # Tests for PREPROCESSOR features # These tests first appeared in version 1.25. use strict; use warnings; use Test::More tests => 9; use File::Temp; use_ok 'Text::Template::Preprocess' or exit 1; my $tmpfile = File::Temp->new; my $TMPFILE = $tmpfile->filename; my $py = sub { tr/x/y/ }; my $pz = sub { tr/x/z/ }; my $t = 'xxx The value of $x is {$x}'; my $outx = 'xxx The value of $x is 119'; my $outy = 'yyy The value of $y is 23'; my $outz = 'zzz The value of $z is 5'; open my $tfh, '>', $TMPFILE or die "Couldn't open test file: $!; aborting"; print $tfh $t; close $tfh; my @result = ($outx, $outy, $outz, $outz); for my $trial (1, 0) { for my $test (0 .. 3) { my $tmpl; if ($trial == 0) { $tmpl = Text::Template::Preprocess->new(TYPE => 'STRING', SOURCE => $t) or die; } else { open $tfh, '<', $TMPFILE or die "Couldn't open test file: $!; aborting"; $tmpl = Text::Template::Preprocess->new(TYPE => 'FILEHANDLE', SOURCE => $tfh) or die; } $tmpl->preprocessor($py) if ($test & 1) == 1; my @args = ((($test & 2) == 2) ? (PREPROCESSOR => $pz) : ()); my $o = $tmpl->fill_in(@args, HASH => { x => 119, 'y' => 23, z => 5 }); is $o, $result[$test]; } }