Adding support for serialization / remoting.
[castle.git] / Tools / NVelocity / test / templates / escape2.vm
blobba018799b5d981c2ec07e4c9a884931e23cea8c7
1 #*
2 @test escape2.vm
4 More interesting cases...
6 This template is used for Velocity regression testing.
7 If you alter this template make sure you change the
8 corresponding comparison file so that the regression 
9 test doesn't fail incorrectly.
12 --- Schmoo ---
14 These are not in the context, so they should render as they are here (schmoo).
15 $foo
16 \$foo
17 \\$foo
19 \#woogie
20 \\#woogie
21 \\\#woogie
23 Now put $foo in the context :
24 #set($foo = "bar")
25 \$foo = $foo
26 \\\$foo =\\$foo
27 \\\\\$foo =\\\\$foo
29 As we increase the number of \'s, we alternate renderings :
30 $foo
31 \$foo
32 \\$foo
33 \\\$foo
34 \\\\$foo
36 --- Pluggable Directives ----
38 We are doing an \#include("test.txt"), starting with 0 '\' preceeding :
40 #include("test.txt")
41 \#include("test.txt")
42 \\#include("test.txt")
43 \\\#include("test.txt")
44 \\\\#include("test.txt")
46 Now, foreach is a PD.  Escape the first one, and then not the second so it
47 renders.  The third and fourth examples show the single 'unpleasantry' about this.  The \
48 is only an escape when 'touching' VTL, otherwise, it's just schmoo.
50 \#foreach(
52 \\#foreach($a in $stringarray) $a \\#end
54 \\#foreach($a in $stringarray) $a \ \\#end
56 \\#foreach($a in $stringarray)$a\ \\#end
59 --- Control Structures ----
61 First should be escaped...
62 \#if(true) hi \#end
64 This isn't.  Note then that it has to render the \\ as a \ because it's stuck to the VTL
66 \\#if(true) hi \\#end
68 \\#if(true) hi #end
70 And so forth...
71 \\\#if(true) hi \\\#end
73 \\\\#if(true) hi \\\\#end
75 And more...
77 \#if(true)
78         hi
79 \#else
80         there
81 \#end
83 \\#if(true)
84         hi
85 \\#else
86         there
87 \\#end
89 \\\#if(true)
90         hi
91 \\\#else
92         there
93 \\\#end
95 \\#if(false)
96         hi
97 \\#elseif(true)
98         there
99 \\#end
101 \\\#if(false)
102         hi
103 \\\#elseif(true)
104         there
105 \\\#end
107 ## testing combinations like #$foo
109 #$foo1
110 \#$foo1
111 #${foo1}
112 \#$${foo1}
113 #set($foo1 = "C0C0C0")
114 #$foo1
115 \#$foo1
116 #${foo1}
117 \#$${foo1}
118 #\$${foo1}
120 ## and wacky stuff that are not references, but
121 ## because of the MORE tokens, get screwed up
123 $(QUERY_STRING{forumid})
124 \$(QUERY_STRING{forumid})
125 \\$(QUERY_STRING{forumid})