blob: 61eb697c98bf0dff14e25efc6a28bb55afc7e6ac [file] [log] [blame]
#*
#*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*#
@test reference.vm
This template is used for Velocity regression testing.
If you alter this template make sure you change the
corresponding comparison file so that the regression
test doesn't fail incorrectly.
*#
#set($_foo = "bar")
$_foo
#if ($_foo.equals("bar"))
\$_foo equals "bar" : $_foo
#end
Late introspection :
$vector.firstElement().length()
More stupid reference escaping ...
When it does exist in the context :
#set($foo = "foo")
$foo
\$foo
\$!foo
$\!foo
$\\!foo
\$\!foo
And when it doesn't :
$bar
\$bar
\$!bar (because it's just text...)
$\!foo
$\\!foo
$\\\!foo
$\\\\!foo
\\$\!foo
Misc tests :
[$foo.bar]
Test lower case property names
$provider.Title
$provider.title
#foreach($i in $provider.vector)
$i
#end
#foreach($i in $provider.Vector)
$i
#end
Now test if we can use lowercase for propertes in set
#set($oldtitle = $provider.title)
Was : $oldtitle
#set($provider.title = "geir")
Now : $provider.title
#set($provider.title = $oldtitle)
Back : $provider.title
Test what was a bug :
#set($b = 'boy')
#set($c = 'cat')
$b${c}.java
${b}${c}.java
More tests :
$provider.title
$$provider.title
#$provider.title
$foo.bar#if( $foo ) ($bar) #end
Test boolean introspection isFoo()
#if( $boolobj.boolean == true )
Correct
#else
Wrong
#end
#if ( $boolobj.notboolean == true )
Wrong
#else
Correct
#end