]> WPIA git - cassiopeia.git/blob - lib/openssl/external/perl/Text-Template-1.46/t/11-prepend.t
upd: openssl to 1.1.0
[cassiopeia.git] / lib / openssl / external / perl / Text-Template-1.46 / t / 11-prepend.t
1 #!perl
2 #
3 # Tests for PREPEND features
4 # These tests first appeared in version 1.22.
5
6 use Text::Template;
7
8 die "This is the test program for Text::Template version 1.46
9 You are using version $Text::Template::VERSION instead.
10 That does not make sense.\n
11 Aborting"
12   unless $Text::Template::VERSION == 1.46;
13
14 print "1..9\n";
15 my $n = 1;
16
17 @Emptyclass1::ISA = 'Text::Template';
18 @Emptyclass2::ISA = 'Text::Template';
19
20 my $tin = q{The value of $foo is: {$foo}};
21
22 Text::Template->always_prepend(q{$foo = "global"});
23
24 $tmpl1 = Text::Template->new(TYPE => 'STRING',
25                                 SOURCE => $tin,         
26                               );
27
28 $tmpl2 = Text::Template->new(TYPE => 'STRING',
29                              SOURCE => $tin,            
30                              PREPEND => q{$foo = "template"},
31                              );
32
33 $tmpl1->compile;
34 $tmpl2->compile;
35
36 $t1 = $tmpl1->fill_in(PACKAGE => 'T1');
37 $t2 = $tmpl2->fill_in(PACKAGE => 'T2');
38 $t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T3');
39
40 ($t1 eq 'The value of $foo is: global') or print "not ";
41 print "ok $n\n"; $n++;
42 ($t2 eq 'The value of $foo is: template') or print "not ";
43 print "ok $n\n"; $n++;
44 ($t3 eq 'The value of $foo is: fillin') or print "not ";
45 print "ok $n\n"; $n++;
46
47 Emptyclass1->always_prepend(q{$foo = 'Emptyclass global';});
48 $tmpl1 = Emptyclass1->new(TYPE => 'STRING',
49                                 SOURCE => $tin,         
50                               );
51
52 $tmpl2 = Emptyclass1->new(TYPE => 'STRING',
53                              SOURCE => $tin,            
54                              PREPEND => q{$foo = "template"},
55                              );
56
57 $tmpl1->compile;
58 $tmpl2->compile;
59
60 $t1 = $tmpl1->fill_in(PACKAGE => 'T4');
61 $t2 = $tmpl2->fill_in(PACKAGE => 'T5');
62 $t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T6');
63
64 ($t1 eq 'The value of $foo is: Emptyclass global') or print "not ";
65 print "ok $n\n"; $n++;
66 ($t2 eq 'The value of $foo is: template') or print "not ";
67 print "ok $n\n"; $n++;
68 ($t3 eq 'The value of $foo is: fillin') or print "not ";
69 print "ok $n\n"; $n++;
70
71 $tmpl1 = Emptyclass2->new(TYPE => 'STRING',
72                                 SOURCE => $tin,         
73                               );
74
75 $tmpl2 = Emptyclass2->new(TYPE => 'STRING',
76                              SOURCE => $tin,            
77                              PREPEND => q{$foo = "template"},
78                              );
79
80 $tmpl1->compile;
81 $tmpl2->compile;
82
83 $t1 = $tmpl1->fill_in(PACKAGE => 'T4');
84 $t2 = $tmpl2->fill_in(PACKAGE => 'T5');
85 $t3 = $tmpl2->fill_in(PREPEND => q{$foo = "fillin"}, PACKAGE => 'T6');
86
87 ($t1 eq 'The value of $foo is: global') or print "not ";
88 print "ok $n\n"; $n++;
89 ($t2 eq 'The value of $foo is: template') or print "not ";
90 print "ok $n\n"; $n++;
91 ($t3 eq 'The value of $foo is: fillin') or print "not ";
92 print "ok $n\n"; $n++;
93
94