1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
#============================================================= -*-perl-*-
#
# t/dumper.t
#
# Test the Dumper plugin.
#
# Written by Simon Matthews <sam@knowledgepool.com>
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# $Id: dumper.t,v 2.2 2001/11/29 16:55:09 abw Exp $
#
#========================================================================
use strict;
use lib qw( ./lib ../lib );
use vars qw( $DEBUG );
use Template::Test;
$^W = 1;
my $params = {
'baz' => 'boo',
};
$DEBUG = 0;
test_expect(\*DATA, undef, { params => $params });
#------------------------------------------------------------------------
__DATA__
[% USE Dumper -%]
Dumper
-- expect --
Dumper
-- test --
[% USE Dumper -%]
[% Dumper.dump({ foo = 'bar' }, 'hello' ) -%]
-- expect --
$VAR1 = {
'foo' => 'bar'
};
$VAR2 = 'hello';
-- test --
[% USE Dumper -%]
[% Dumper.dump(params) -%]
-- expect --
$VAR1 = {
'baz' => 'boo'
};
-- test --
[% USE Dumper -%]
[% Dumper.dump_html(params) -%]
-- expect --
$VAR1 = {<br>
'baz' => 'boo'<br>
};<br>
-- test --
[% USE dumper(indent=1, pad='> ', varname="frank") -%]
[% dumper.dump(params) -%]
-- expect --
> $frank1 = {
> 'baz' => 'boo'
> };
-- test --
[% USE dumper(Pad='>> ', Varname="bob") -%]
[% dumper.dump(params) -%]
-- expect --
>> $bob1 = {
>> 'baz' => 'boo'
>> };
|