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
19use strict;
20use lib qw( ./lib ../lib );
21use Template::Test;
22$^W = 1;
23
24$Template::Test::DEBUG = 0;
25
26ok(1);
27
28my $ttdef = Template->new({
29    POST_CHOMP => 1,
30});
31
32my $ttanycase = Template->new({ 
33    ANYCASE => 1, 
34    POST_CHOMP => 1,
35});
36
37my $tts = [ default => $ttdef, anycase => $ttanycase ];
38
39test_expect(\*DATA, $tts, callsign());
40
41__DATA__
42-- test --
43[% include = a %]
44[% for = b %]
45i([% include %])
46f([% for %])
47-- expect --
48i(alpha)
49f(bravo)
50
51-- test --
52[% IF a AND b %]
53good
54[% ELSE %]
55bad
56[% END %]
57-- expect --
58good
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 %]
64good
65[% ELSE %]
66bad
67[% END %]
68-- expect --
69good
70
71-- test --
72[% include = a %]
73[% include %]
74-- expect --
75alpha
76
77-- test --
78-- use anycase --
79[% include foo bar='baz' %]
80[% BLOCK foo %]this is foo, bar = [% bar %][% END %]
81-- expect --
82this is foo, bar = baz
83
84-- test --
85[% 10 div 3 %] [% 10 DIV 3 +%]
86[% 10 mod 3 %] [% 10 MOD 3 %]
87-- expect --
883 3
891 1
90