Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 84 lines (66 sloc) 1.382 kb
7a871442 »
2000-10-03 added Dumper plugin, fixed DOM, misc other fixes
1 #============================================================= -*-perl-*-
2 #
3 # t/dumper.t
4 #
5 # Test the Dumper plugin.
6 #
7 # Written by Simon Matthews <sam@knowledgepool.com>
8 #
9 # This is free software; you can redistribute it and/or modify it
10 # under the same terms as Perl itself.
11 #
12 # $Id$
13 #
14 #========================================================================
15
16 use strict;
17 use lib qw( ./lib ../lib );
18 use vars qw( $DEBUG );
19 use Template::Test;
20 $^W = 1;
21
22 my $params = {
23 'baz' => 'boo',
24 };
25
26 $DEBUG = 0;
27
28 test_expect(\*DATA, undef, { params => $params });
29
30 #------------------------------------------------------------------------
31
32 __DATA__
33 [% USE Dumper -%]
34 Dumper
35
36 -- expect --
37 Dumper
38
39 -- test --
40 [% USE Dumper -%]
7526b546 »
2001-11-29 * changed hashes to only have one entry to avoid ordering problems
41 [% Dumper.dump({ foo = 'bar' }, 'hello' ) -%]
7a871442 »
2000-10-03 added Dumper plugin, fixed DOM, misc other fixes
42
43 -- expect --
44 $VAR1 = {
7526b546 »
2001-11-29 * changed hashes to only have one entry to avoid ordering problems
45 'foo' => 'bar'
7a871442 »
2000-10-03 added Dumper plugin, fixed DOM, misc other fixes
46 };
47 $VAR2 = 'hello';
48
49
50 -- test --
51 [% USE Dumper -%]
52 [% Dumper.dump(params) -%]
53
54 -- expect --
55 $VAR1 = {
56 'baz' => 'boo'
57 };
58
59 -- test --
60 [% USE Dumper -%]
61 [% Dumper.dump_html(params) -%]
62
63 -- expect --
64 $VAR1 = {<br>
65 'baz' =&gt; 'boo'<br>
66 };<br>
67
68 -- test --
69 [% USE dumper(indent=1, pad='> ', varname="frank") -%]
70 [% dumper.dump(params) -%]
71
72 -- expect --
73 > $frank1 = {
74 > 'baz' => 'boo'
75 > };
76
77 -- test --
78 [% USE dumper(Pad='>> ', Varname="bob") -%]
79 [% dumper.dump(params) -%]
80
81 -- expect --
82 >> $bob1 = {
83 >> 'baz' => 'boo'
84 >> };
85
Something went wrong with that request. Please try again.