1#* 2 3@test map.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## This is a valid Map and Bar is a valid 13## element. 14 15$hashtable.Bar 16 17## test the new Map support 18 19#set( $hashtable.Foo = "foovalue") 20$hashtable.get("Foo") 21$hashtable.Foo 22 23#set( $hashmap.Foo = "foovalue") 24$hashmap.Foo 25$hashmap.get("Foo") 26 27 28## 29## test the support for the Map creation syntax 30## 31#set($key = 'key') 32#set($value = 'value') 33 34#set($mymap = { "a" : "aval", "bar" : "booboo", 'b' : 'bval', 1 : 2, $key : $value, 'hash' : $hashmap } ) 35$mymap.put("bar", { "aa" : "aaa" }) 36$mymap.a 37$mymap.get("a") 38$mymap.b 39$mymap.get('b') 40$mymap.get(1) 41$mymap.get($key) 42$mymap.hash.Foo 43$mymap.map.foo 44$mymap.bar 45 46## 47## test for empty map 48## 49 50#set($emptymap = {}) 51$emptymap.size() 52 53#set($emptymap = { }) 54$emptymap.size() 55 56## 57## test for values given with reference 58## 59 60#set($object = "aa") 61#set($mapz = {"a" : $object, "b" : "bb" }) 62#set($mapx = {"a" : "bb", "b" : $object }) 63#set($mapy = {"key": $object}) 64$mapz.a 65$mapz.b 66$mapx.a 67$mapx.b 68$mapy.key 69