• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#*
2
3@test reference.vm
4
5This template is used for Velocity regression testing.
6If you alter this template make sure you change the
7corresponding comparison file so that the regression
8test doesn't fail incorrectly.
9
10*#
11
12#set($_foo = "bar")
13$_foo
14#if ($_foo.equals("bar"))
15   \$_foo equals "bar" : $_foo
16#end
17
18Late introspection :
19
20$vector.firstElement().length()
21
22
23More stupid reference escaping ...
24
25When it does exist in the context :
26
27#set($foo = "foo")
28$foo
29\$foo
30\$!foo
31$\!foo
32$\\!foo
33\$\!foo
34
35And when it doesn't :
36
37$bar
38\$bar
39
40\$!bar  (because it's just text...)
41
42$\!foo
43$\\!foo
44$\\\!foo
45$\\\\!foo
46\\$\!foo
47
48Misc tests :
49
50[$foo.bar]
51
52
53Test lower case property names
54
55$provider.Title
56$provider.title
57
58#foreach($i in $provider.vector)
59 $i
60#end
61#foreach($i in $provider.Vector)
62 $i
63#end
64
65Now test if we can use lowercase for propertes in set
66#set($oldtitle = $provider.title)
67Was : $oldtitle
68#set($provider.title = "geir")
69Now : $provider.title
70#set($provider.title = $oldtitle)
71Back : $provider.title
72
73Test what was a bug :
74
75#set($b = 'boy')
76#set($c = 'cat')
77$b${c}.java
78${b}${c}.java
79
80
81More tests :
82
83$provider.title
84$$provider.title
85#$provider.title
86
87$foo.bar#if( $foo ) ($bar) #end
88
89
90Test boolean introspection isFoo()
91
92#if( $boolobj.boolean == true )
93  Correct
94#else
95  Wrong
96#end
97
98
99#if ( $boolobj.notboolean == true )
100   Wrong
101#else
102   Correct
103#end
104
105