Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (76 sloc) 1.495 kb
e1ad160 @abw *** empty log message ***
authored
1 #============================================================= -*-perl-*-
2 #
3 # t/case.t
4 #
5 # Test the CASE sensitivity option.
6 #
7 # Written by Andy Wardley <abw@kfs.org>
8 #
9 # Copyright (C) 1996-2000 Andy Wardley. All Rights Reserved.
10 # Copyright (C) 1998-2000 Canon Research Centre Europe Ltd.
11 #
12 # This is free software; you can redistribute it and/or modify it
13 # under the same terms as Perl itself.
14 #
15 # $Id$
16 #
17 #========================================================================
18
19 use strict;
20 use lib qw( ./lib ../lib );
21 use Template::Test;
22 $^W = 1;
23
24 $Template::Test::DEBUG = 0;
25
26 ok(1);
27
0b63aae @abw *** empty log message ***
authored
28 my $ttdef = Template->new({
29 POST_CHOMP => 1,
30 });
31
d52480d @abw *** empty log message ***
authored
32 my $ttanycase = Template->new({
33 ANYCASE => 1,
e1ad160 @abw *** empty log message ***
authored
34 POST_CHOMP => 1,
0b63aae @abw *** empty log message ***
authored
35 });
36
d52480d @abw *** empty log message ***
authored
37 my $tts = [ default => $ttdef, anycase => $ttanycase ];
e1ad160 @abw *** empty log message ***
authored
38
0b63aae @abw *** empty log message ***
authored
39 test_expect(\*DATA, $tts, callsign());
e1ad160 @abw *** empty log message ***
authored
40
41 __DATA__
42 -- test --
43 [% include = a %]
44 [% for = b %]
45 i([% include %])
46 f([% for %])
47 -- expect --
48 i(alpha)
49 f(bravo)
50
51 -- test --
52 [% IF a AND b %]
53 good
54 [% ELSE %]
55 bad
56 [% END %]
57 -- expect --
58 good
59
60 -- test --
61 # 'and', 'or' and 'not' can ALWAYS be expressed in lower case, regardless
62 # of CASE sensitivity option.
63 [% IF a and b %]
64 good
65 [% ELSE %]
66 bad
67 [% END %]
68 -- expect --
69 good
70
71 -- test --
72 [% include = a %]
73 [% include %]
74 -- expect --
75 alpha
76
0b63aae @abw *** empty log message ***
authored
77 -- test --
d52480d @abw *** empty log message ***
authored
78 -- use anycase --
0b63aae @abw *** empty log message ***
authored
79 [% include foo bar='baz' %]
80 [% BLOCK foo %]this is foo, bar = [% bar %][% END %]
81 -- expect --
82 this is foo, bar = baz
e1ad160 @abw *** empty log message ***
authored
83
d52480d @abw *** empty log message ***
authored
84 -- test --
85 [% 10 div 3 %] [% 10 DIV 3 +%]
86 [% 10 mod 3 %] [% 10 MOD 3 %]
87 -- expect --
88 3 3
89 1 1
Something went wrong with that request. Please try again.