freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [12/19] incubator-freemarker git commit: Moving TemplateTestSuite to freemarker-test-utils, so that it can be used from multiple modules. It had to be generalized for this a bit, as now it has a CoreTemplateTestSuite subclass in freemarker-core-test.
Date Tue, 16 May 2017 16:09:10 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-iso-like.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-iso-like.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-iso-like.ftl
new file mode 100644
index 0000000..a5accaf
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-iso-like.ftl
@@ -0,0 +1,155 @@
+<#--
+  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.
+-->
+<#assign d = "2010-05-15 22:38:05:23 +0200"?datetime("yyyy-MM-dd HH:mm:ss:S Z")>
+<#setting time_zone="GMT+02">
+<@assertEquals actual=d?string.xs  expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string.iso expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string('xs')  expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string('iso') expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string.xs_nz  expected="2010-05-15T22:38:05.023" />
+<@assertEquals actual=d?string.iso_nz expected="2010-05-15T22:38:05.023" />
+<@assertEquals actual=d?string.xs_fz  expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string.iso_fz expected="2010-05-15T22:38:05.023+02:00" />
+<@assertEquals actual=d?string.xs_u  expected="2010-05-15T20:38:05.023Z" />
+<@assertEquals actual=d?string.iso_u expected="2010-05-15T20:38:05.023Z" />
+<@assertEquals actual=d?string.xs_s_u  expected="2010-05-15T20:38:05Z" />
+<@assertEquals actual=d?string.iso_s_u expected="2010-05-15T20:38:05Z" />
+
+<@assertEquals actual=d?date?string.xs  expected="2010-05-15+02:00" />
+<@assertEquals actual=d?date?string.iso expected="2010-05-15" />
+<@assertEquals actual=d?date?string.xs_nz  expected="2010-05-15" />
+<@assertEquals actual=d?date?string.iso_nz expected="2010-05-15" />
+<@assertEquals actual=d?date?string.xs_fz  expected="2010-05-15+02:00" />
+<@assertEquals actual=d?date?string.iso_fz expected="2010-05-15" />
+
+<@assertEquals actual=d?time?string.xs  expected="22:38:05.023+02:00" />
+<@assertEquals actual=d?time?string.iso expected="22:38:05.023+02:00" />
+<@assertEquals actual=d?time?string.xs_nz  expected="22:38:05.023" />
+<@assertEquals actual=d?time?string.iso_nz expected="22:38:05.023" />
+<@assertEquals actual=d?time?string.xs_fz  expected="22:38:05.023+02:00" />
+<@assertEquals actual=d?time?string.iso_fz expected="22:38:05.023+02:00" />
+
+<#-- java.sql treatment -->
+<@assertEquals actual=sqlDate?string.xs  expected="2010-05-15" />
+<@assertEquals actual=sqlDate?string.iso expected="2010-05-15" />
+<@assertEquals actual=sqlDate?string.xs_fz  expected="2010-05-15+02:00" />
+<@assertEquals actual=sqlDate?string.iso_fz expected="2010-05-15" />
+<@assertEquals actual=sqlDate?string.xs_nz  expected="2010-05-15" />
+<@assertEquals actual=sqlDate?string.iso_nz expected="2010-05-15" />
+<@assertEquals actual=sqlTime?string.xs  expected="22:38:05.023" />
+<@assertEquals actual=sqlTime?string.iso expected="22:38:05.023" />
+<@assertEquals actual=sqlTime?string.xs_fz  expected="22:38:05.023+02:00" />
+<@assertEquals actual=sqlTime?string.iso_fz expected="22:38:05.023+02:00" />
+<@assertEquals actual=sqlTime?string.xs_nz  expected="22:38:05.023" />
+<@assertEquals actual=sqlTime?string.iso_nz expected="22:38:05.023" />
+
+<#assign d = "12:30:15:1 +0200"?time("HH:mm:ss:S Z")>
+<@assertEquals actual=d?string.xs  expected="12:30:15.001+02:00" />
+<@assertEquals actual=d?string.iso expected="12:30:15.001+02:00" />
+<@assertEquals actual=d?string.xs_ms  expected="12:30:15.001+02:00" />
+<@assertEquals actual=d?string.iso_ms expected="12:30:15.001+02:00" />
+<@assertEquals actual=d?string.iso_s expected="12:30:15+02:00" />
+<@assertEquals actual=d?string.iso_m expected="12:30+02:00" />
+<@assertEquals actual=d?string.iso_h expected="12+02:00" />
+<#assign d = "12:30:15:10 +0200"?time("HH:mm:ss:S Z")>
+<@assertEquals actual=d?string.xs  expected="12:30:15.01+02:00" />
+<@assertEquals actual=d?string.iso expected="12:30:15.01+02:00" />
+<@assertEquals actual=d?string.xs_ms  expected="12:30:15.010+02:00" />
+<@assertEquals actual=d?string.iso_ms expected="12:30:15.010+02:00" />
+<#assign d = "12:30:15:100 +0200"?time("HH:mm:ss:S Z")>
+<@assertEquals actual=d?string.xs  expected="12:30:15.1+02:00" />
+<@assertEquals actual=d?string.iso expected="12:30:15.1+02:00" />
+<@assertEquals actual=d?string.xs_ms  expected="12:30:15.100+02:00" />
+<@assertEquals actual=d?string.iso_ms expected="12:30:15.100+02:00" />
+<#assign d = "12:30:15:0 +0200"?time("HH:mm:ss:S Z")>
+<@assertEquals actual=d?string.xs  expected="12:30:15+02:00" />
+<@assertEquals actual=d?string.iso expected="12:30:15+02:00" />
+<@assertEquals actual=d?string.xs_ms  expected="12:30:15.000+02:00" />
+<@assertEquals actual=d?string.iso_ms expected="12:30:15.000+02:00" />
+
+<#setting time_zone="GMT+02">
+<#assign d = "2010-05-15"?date("yyyy-MM-dd")>
+<@assertEquals actual=d?string.xs  expected="2010-05-15+02:00" />
+<@assertEquals actual=d?string.iso expected="2010-05-15" />
+<#setting time_zone="GMT+00">
+<@assertEquals actual=d?string.xs  expected="2010-05-14Z" />
+<@assertEquals actual=d?string.iso expected="2010-05-14" />
+
+<#setting time_zone="GMT+02:30">
+<#assign d = "2010-05-15"?datetime("yyyy-MM-dd")>
+<@assertEquals actual=d?string.xs  expected="2010-05-15T00:00:00+02:30" />
+<@assertEquals actual=d?string.iso expected="2010-05-15T00:00:00+02:30" />
+
+<#setting time_zone="GMT-05">
+<#setting locale = "en_US">
+<#assign d = "BC 0001-05-15"?date("G yyyy-MM-dd")>
+<#-- Tests that: (a) BC 1 isn't 0 like in ISO 8601; (b) No Julian calendar is used.  -->
+<@assertEquals actual=d?string.xs  expected="-1-05-13-05:00" />
+<@assertEquals actual=d?string.iso expected="0000-05-13" />
+
+<#assign dt = "2010-05-15T01:02:03"?datetime.xs>
+<#setting datetime_format="xs">
+<@assertEquals actual=dt?string expected="2010-05-15T01:02:03-05:00" />
+<#setting datetime_format="xs u">
+<@assertEquals actual=dt?string expected="2010-05-15T06:02:03Z" />
+<#setting datetime_format="iso u">
+<@assertEquals actual=dt?string expected="2010-05-15T06:02:03Z" />
+<#setting datetime_format="xs fz">
+<@assertEquals actual=dt?string expected="2010-05-15T01:02:03-05:00" />
+<#setting datetime_format="xs fz u">
+<@assertEquals actual=dt?string expected="2010-05-15T06:02:03Z" />
+<#setting datetime_format="xs nz u">
+<@assertEquals actual=dt?string expected="2010-05-15T06:02:03" />
+<#setting datetime_format="iso m nz">
+<@assertEquals actual=dt?string expected="2010-05-15T01:02" />
+
+<#assign d = dt?date>
+<#setting date_format="xs">
+<@assertEquals actual=d?string expected="2010-05-15-05:00" />
+<#setting date_format="iso">
+<@assertEquals actual=d?string expected="2010-05-15" />
+<#setting date_format="xs fz">
+<@assertEquals actual=d?string expected="2010-05-15-05:00" />
+<#setting date_format="xs fz u">
+<@assertEquals actual=d?string expected="2010-05-15Z" />
+<#setting date_format="iso fz u">
+<@assertEquals actual=d?string expected="2010-05-15" />
+<#setting date_format="xs nz">
+<@assertEquals actual=d?string expected="2010-05-15" />
+
+<#assign t = dt?time>
+<@assertEquals actual=d?string expected="2010-05-15" />
+<#setting time_format="xs">
+<@assertEquals actual=t?string expected="01:02:03-05:00" />
+<#setting time_format="iso_m">
+<@assertEquals actual=t?string expected="01:02-05:00" />
+<#setting time_format="xs fz">
+<@assertEquals actual=t?string expected="01:02:03-05:00" />
+<#setting time_format="xs nz">
+<@assertEquals actual=t?string expected="01:02:03" />
+<#setting time_format="iso nz ms">
+<@assertEquals actual=t?string expected="01:02:03.000" />
+
+<@assertFails message="Use ?date, ?time, or ?datetime">${unknownDate?string.xs}</@>
+<@assertFails message="Use ?date, ?time, or ?datetime">${unknownDate?string.iso}</@>
+<@assertFails message="format string">${.now?string.xs_fz_nz}</@>
+<@assertFails message="format string">${.now?string.xs_u_fu}</@>
+<@assertFails message="format string">${.now?string.xs_s_ms}</@>
+<@assertFails message="format string">${.now?string.xs_q}</@>
+<@assertFails message="format string">${.now?string.xss}</@>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
new file mode 100644
index 0000000..82001db
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateformat-java.ftl
@@ -0,0 +1,71 @@
+<#--
+  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.
+-->
+<#setting locale="en_US">
+<#setting time_zone="GMT">
+<#setting datetime_format="">
+${date}
+${unknownDate?datetime}
+${date?string}
+${date?string[""]}
+${date?string.short}
+${date?string.medium}
+${date?string.long}
+${date?string.short_short}
+${date?string.short_medium}
+${date?string.short_long}
+${date?string.medium_short}
+${date?string.medium_medium}
+${date?string.medium_long}
+${date?string.long_short}
+${date?string.long_medium}
+${date?string.long_long}
+${unknownDate?date}
+${date?date?string[""]}
+${date?date?string.short}
+${date?date?string.medium}
+${date?date?string.long}
+${unknownDate?time}
+${date?time?string[""]}
+${date?time?string.short}
+${date?time?string.medium}
+${date?time?string.long}
+<#setting locale="hu_hu">
+<#setting datetime_format="long_long">
+${date}
+<#setting locale="en_US">
+<#setting datetime_format="EEE, dd MMM yyyyy HH:mm:ss z">
+${date}
+${unknownDate?string["EEE, dd MMM yyyy HH:mm:ss z"]}
+${unknownDate?string("EEE, dd MMM yyyy HH:mm:ss z")}
+${unknownDate?string.yyyy}
+
+<#setting datetime_format="yyyy">
+<#assign s = date?string>
+${s}
+<#setting datetime_format="MM">
+${s}
+
+<#-- Check ?string lazy evaluation bug was fixed: -->
+<#setting datetime_format="yyyy">
+<#assign s = date?string>
+<#-- no ${s} -->
+<#setting datetime_format="MM">
+${s}
+<#assign s = date?string>
+${s}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateparsing.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateparsing.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateparsing.ftl
new file mode 100644
index 0000000..d830f95
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/dateparsing.ftl
@@ -0,0 +1,84 @@
+<#--
+  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.
+-->
+<#setting locale="en_US">
+<#setting time_zone="GMT">
+<#setting datetime_format="G yyyy-MM-dd HH:mm:ss.S Z">
+<#setting date_format="G yyyy-MM-dd Z">
+<#setting time_format="HH:mm:ss.S Z">
+
+<@assertEquals expected="AD 1998-10-30 15:30:44.512 +0000" actual='AD 1998-10-30 19:30:44.512 +0400'?datetime?string />
+<@assertEquals expected="AD 1998-10-29 +0000" actual='AD 1998-10-30 +0400'?date?string />
+<@assertEquals expected="15:30:44.512 +0000" actual='19:30:44.512 +0400'?time?string />
+
+<@assertEquals expected="AD 1998-10-30 15:30:44.512 +0000"
+               actual='10/30/1998 19:30:44:512 GMT+04:00'?datetime("MM/dd/yyyy HH:mm:ss:S z")?string />
+<@assertEquals expected="AD 1998-10-29 +0000"
+               actual='10/30/1998 GMT+04:00'?date("MM/dd/yyyy z")?string />
+<@assertEquals expected="15:30:44.512 +0000"
+               actual='19:30:44:512 GMT+04:00'?time("HH:mm:ss:S z")?string />
+
+<@assertEquals expected="AD 1998-10-30 15:30:44.512 +0000" actual='1998-10-30T19:30:44.512+04:00'?datetime.xs?string />
+<@assertEquals expected="AD 1998-10-29 +0000" actual='1998-10-30+04:00'?date.xs?string />
+<@assertEquals expected="15:30:44.512 +0000" actual='19:30:44.512+04:00'?time.xs?string />
+
+<#assign gmtStr='1998-10-30T19:30:44.512'?datetime.xs?string />
+<#setting time_zone="GMT+01:00">
+<#assign gmt01Str='1998-10-30T19:30:44.512'?datetime.xs?string />
+<#setting time_zone="default">
+<#assign defStr='1998-10-30T19:30:44.512'?datetime.xs?string />
+<@assert test = gmtStr != gmt01Str />
+<@assert test = defStr != gmtStr || defStr != gmt01Str />
+
+<#assign refDate = "AD 1998-10-30 +0000"?date>
+<#assign refTime = "15:30:44.512 +0000"?time>
+<#assign refDateTime = "AD 1998-10-30 15:30:44.512 +0000"?datetime>
+<#setting time_zone="UTC">
+<#list ['xs', 'xs_nz', 'xs_fz', 'xs s', 'xs ms'] as format>
+  <#setting date_format=format>
+  <#setting time_format=format>
+  <#setting datetime_format=format>
+  <@assertEquals expected=refDate actual="1998-10-30Z"?date />
+  <@assertEquals expected=refTime actual="15:30:44.512Z"?time />
+  <@assertEquals expected=refDateTime actual="1998-10-30T15:30:44.512Z"?datetime />
+</#list>
+<#list ['iso', 'iso_nz', 'iso_fz', 'iso m'] as format>
+  <#setting date_format=format>
+  <#setting time_format=format>
+  <#setting datetime_format=format>
+  <@assertEquals expected=refDate actual="1998-10-30"?date />
+  <@assertEquals expected=refDate actual="19981030"?date />
+  <@assertEquals expected=refTime actual="15:30:44,512Z"?time />
+  <@assertEquals expected=refTime actual="153044,512Z"?time />
+  <@assertEquals expected=refDateTime actual="1998-10-30T15:30:44,512Z"?datetime />
+  <@assertEquals expected=refDateTime actual="19981030T153044,512Z"?datetime />
+</#list>
+
+<#setting time_zone="GMT+01:00">
+<#assign refDateTime='1998-10-30T19:30:44.512'?datetime.xs />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512"?datetime.xs />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512"?datetime.iso />
+<@assertEquals expected=refDateTime actual="1998-10-30T18:30:44.512"?datetime.xs_u />
+<@assertEquals expected=refDateTime actual="1998-10-30T18:30:44.512"?datetime.iso_u />
+<#setting time_zone="UTC">
+<@assertEquals expected=refDateTime actual="1998-10-30T18:30:44.512"?datetime.xs />
+<@assertEquals expected=refDateTime actual="1998-10-30T18:30:44.512"?datetime.iso />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512+01:00"?datetime.xs />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512+01:00"?datetime.xs_u />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512+01"?datetime.iso />
+<@assertEquals expected=refDateTime actual="1998-10-30T19:30:44.512+01"?datetime.iso_u />
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-object-wrapper.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-object-wrapper.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-object-wrapper.ftl
new file mode 100644
index 0000000..21efc05
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-object-wrapper.ftl
@@ -0,0 +1,59 @@
+<#--
+  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.
+-->
+<#list array as item>
+${item}
+</#list>
+${array?size}
+${array[0]}
+${array[1]}
+<#list list as item>
+${item}
+</#list>
+${list?size}
+${list?hasContent?then('not empty', 'empty')}
+${list[0]}
+${map.key}
+${map?api.get(objKey)}
+${obj.foo}
+<#if obj.foo?exists>hasfoo<#else>nofoo</#if>
+<#if obj.baz?exists>hasbaz<#else>nobaz</#if>
+${obj.bar[0]}
+${obj.getFoo()}
+${obj.overloaded(1?int)}
+${obj.overloaded("String")}
+${resourceBundle.message}
+${resourceBundle("format", date)}
+<#assign static = statics["org.apache.freemarker.core.templatesuite.models.BeanTestClass"]>
+${static.staticMethod()}
+${static.staticOverloaded(1)}
+${static.staticOverloaded("String")}
+${static.STATIC_FINAL_FIELD}
+${static.STATIC_FIELD}
+<#assign enum = enums["org.apache.freemarker.core.templatesuite.models.EnumTestClass"]>
+${enum.ONE}
+${enum.TWO}
+${enum.THREE}
+${(enum.ONE == enum.ONE)?string("true", "false")}
+${(enum.ONE == enum.TWO)?string("true", "false")}
+${enums["org.apache.freemarker.core.templatesuite.models.BeanTestClass"]?exists?string("true", "false")}
+${obj.something}
+${obj.publicInner.x}
+${obj.publicInner.m()}
+<@assertFails message="obj.privateInner.x">${obj.privateInner.x}</@>
+<@assertFails message="obj.privateInner.m">${obj.privateInner.m()}</@>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
new file mode 100644
index 0000000..4f01835
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
@@ -0,0 +1,28 @@
+<#ftl ns_prefixes={"D" : "http://x.com", "y" : "http://y.com"}>
+<#--
+  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.
+-->
+<#assign r = doc.*[0]>
+${r["N:t1"]?default('-')} = No NS
+${r["t2"]?default('-')} = x NS
+${r["y:t3"]?default('-')} = y NS
+${r["./D:t4"]?default('-')} = x NS
+
+<#assign bool = doc["true()"]>
+${bool?string}
+

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default.ftl
new file mode 100644
index 0000000..6ecf8b3
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default.ftl
@@ -0,0 +1,34 @@
+<#--
+  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.
+-->
+${UNDEFINED!"foo"}
+
+<#assign duck = (FOO.BAR)!"luck">
+${duck}
+
+<#list UNDEFINED![] as item>
+   ${item}
+</#list>
+
+${UNDEFINED![]?size}
+
+<#if UNDEFINED??>
+   UNDEFINED is defined.
+<#else>
+   UNDEFINED is undefined.
+</#if>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/encoding-builtins.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/encoding-builtins.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/encoding-builtins.ftl
new file mode 100644
index 0000000..6ee2a26
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/encoding-builtins.ftl
@@ -0,0 +1,52 @@
+<#--
+  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.
+-->
+FreeMarker: Encoding built-in tests
+
+<#assign x = "&<>\"'{}\\a/">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+rtf:  [${x?rtf}]
+<#assign x = "a&a<a>a\"a'a{a}a\\">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+rtf:  [${x?rtf}]
+<#assign x = "<<<<<">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+<#assign x = "{{{{{">
+rtf:  [${x?rtf}]
+<#assign x = "">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+rtf:  [${x?rtf}]
+<#assign x = "a">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+rtf:  [${x?rtf}]
+<#assign x = "&">
+html: [${x?html}]
+xml:  [${x?xml}]
+xhtml: [${x?xhtml}]
+<#assign x = "{">
+rtf:  [${x?rtf}]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/escapes.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/escapes.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/escapes.ftl
new file mode 100644
index 0000000..20efc67
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/escapes.ftl
@@ -0,0 +1,79 @@
+<#--
+  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.
+-->
+<#assign h=["","a","b","c"]>
+<#assign g={"x":1,"y":2,"z":3}>
+<#escape x as h[x]>
+${1}
+${2}
+${3}
+<#escape x as g[x]>
+${"x"}
+${"y"}
+${"z"}
+<#noescape>${1}</#noescape>
+<#noescape><#noescape>${1}</#noescape></#noescape>
+</#escape>
+${1}
+${2}
+${3}
+</#escape>
+<#escape x as x?html>
+${"<&>"}
+<#escape x as x?xml>
+${"<&>"}
+</#escape>
+${"<&>"}
+</#escape>
+---
+<#assign x = "<Mooo>">
+${x} = <Mooo>
+<#escape x as x?upper_case>
+  ${x} = <MOOO>
+  <#escape x as x?html>
+    ${x} = &lt;MOOO&gt;
+    <#noescape>
+      ${x} = <MOOO>
+    </#noescape>
+    ${x} = &lt;MOOO&gt;
+  </#escape>
+  ${x} = <MOOO>
+  <#noescape>
+    ${x} = <Mooo>
+    <#escape x as x?html>
+      ${x} = &lt;Mooo&gt;
+      <#noescape>
+        ${x} = <Mooo>
+      </#noescape>
+      ${x} = &lt;Mooo&gt;
+    </#escape>
+    ${x} = <Mooo>
+  </#noescape>
+  ${x} = <MOOO>
+</#escape>
+<#escape az as ["red", "green", "blue"][az-1]>
+  ${1} ${2} ${3}
+</#escape>
+---
+<#assign s = 'A&B'>
+<#escape x as '<' + x?html + '>[' + x?lower_case + '](' + x + ')'>
+  ${s} ${s + 2}
+  <#escape x as '{' + x?lower_case + '}' + x>
+    ${s} ${s + 2}
+  </#escape>
+</#escape>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception.ftl
new file mode 100644
index 0000000..83ae356
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception.ftl
@@ -0,0 +1,31 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Exception Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${message} <br />
+${test}</p>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception2.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception2.ftl
new file mode 100644
index 0000000..83ae356
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception2.ftl
@@ -0,0 +1,31 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Exception Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${message} <br />
+${test}</p>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception3.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception3.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception3.ftl
new file mode 100644
index 0000000..f386fec
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/exception3.ftl
@@ -0,0 +1,31 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Exception Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${message} <br />
+${%@#$test}</p>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/existence-operators.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/existence-operators.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/existence-operators.ftl
new file mode 100644
index 0000000..2f9bdce
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/existence-operators.ftl
@@ -0,0 +1,141 @@
+<#--
+  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.
+-->
+<@isIRE>${v}</@>
+<@isIRE>${w}</@>
+<@isNonFastIRE>${v}</@> <#-- To check that it isn't an IRE.FAST_INSTANCE -->
+
+<@assertEquals actual=v!'-' expected='-' />
+<@assertEquals actual=(v)!'-' expected='-' />
+<@assertEquals actual=(v!) expected='' />
+<@assertEquals actual=((v)!) expected='' />
+<@isNonFastIRE>${v}</@> <#-- To check that it isn't an IRE.FAST_INSTANCE -->
+<@assertEquals actual=v?? expected=false />
+<@assertEquals actual=(v)?? expected=false />
+<@assertEquals actual=v?default('-') expected='-' />
+<@assertEquals actual=(v)?default('-') expected='-' />
+<@isNonFastIRE>${v}</@> <#-- To check that it isn't an IRE.FAST_INSTANCE -->
+<@assertEquals actual=v?exists expected=false />
+<@assertEquals actual=(v)?exists expected=false />
+<@assertEquals actual=v?if_exists expected='' />
+<@assertEquals actual=(v)?if_exists expected='' />
+<@assertEquals actual=v?has_content expected=false />
+<@assertEquals actual=(v)?has_content expected=false />
+
+<@assertEquals actual=v?default(w, '-') expected='-' />
+<@assertEquals actual=v!w!'-' expected='-' />
+<#assign w = 'W'>
+<@assertEquals actual=v?default(w, '-') expected='W' />
+<@assertEquals actual=v!w!'-' expected='W' />
+
+<#list ['V', 1.5] as v>
+	<@assertEquals actual=v!'-' expected=v />
+	<@assertEquals actual=(v)!'-' expected=v />
+	<@assert test=v?? />
+	<@assert test=(v)?? />
+	<@assertEquals actual=v?default('-') expected=v />
+	<@assertEquals actual=(v)?default('-') expected=v />
+	<@assert test=v?exists />
+	<@assert test=(v)?exists />
+	<@assertEquals actual=v?if_exists expected=v />
+	<@assertEquals actual=(v)?if_exists expected=v />
+	<@assert test=v?has_content />
+	<@assert test=(v)?has_content />
+</#list>
+<@assert test=!v?? />
+<@assert test=!v?exists />
+<@isNonFastIRE>${v}</@> <#-- To check that it isn't an IRE.FAST_INSTANCE -->
+
+<@isIRE>${u.v!'-'}</@>
+<@assertEquals actual=(u.v)!'-' expected='-' />
+<@isIRE>${u.v??}</@>
+<@assertEquals actual=(u.v)?? expected=false />
+<@isIRE>${u.v?default('-')}</@>
+<@assertEquals actual=(u.v)?default('-') expected='-' />
+<@isIRE>${u.v?exists}</@>
+<@assertEquals actual=(u.v)?exists expected=false />
+<@isIRE>${u.v?if_exists}</@>
+<@assertEquals actual=(u.v)?if_exists expected='' />
+<@isIRE>${u.v?has_content}</@>
+<@assertEquals actual=(u.v)?has_content expected=false />
+
+<#assign u = { 'x': 'X' } >
+<@assertEquals actual=u.v!'-' expected='-' />
+<@assertEquals actual=(u.v)!'-' expected='-' />
+<@assertEquals actual=u.v?? expected=false />
+<@assertEquals actual=(u.v)?? expected=false />
+<@assertEquals actual=u.v?default('-') expected='-' />
+<@assertEquals actual=(u.v)?default('-') expected='-' />
+<@assertEquals actual=u.v?exists expected=false />
+<@assertEquals actual=(u.v)?exists expected=false />
+<@assertEquals actual=u.v?if_exists expected='' />
+<@assertEquals actual=(u.v)?if_exists expected='' />
+<@assertEquals actual=u.v?has_content expected=false />
+<@assertEquals actual=(u.v)?has_content expected=false />
+
+<#assign u = { 'v': 'V' } >
+<@assertEquals actual=u.v!'-' expected='V' />
+<@assertEquals actual=(u.v)!'-' expected='V' />
+<@assert test=u.v?? />
+<@assert test=(u.v)?? />
+<@assertEquals actual=u.v?default('-') expected='V' />
+<@assertEquals actual=(u.v)?default('-') expected='V' />
+<@assert test=u.v?exists />
+<@assert test=(u.v)?exists />
+<@assertEquals actual=u.v?if_exists expected='V' />
+<@assertEquals actual=(u.v)?if_exists expected='V' />
+<@assert test=u.v?has_content />
+<@assert test=(u.v)?has_content />
+
+<#list 1..4 as i>
+  <#if i == 3><#assign x = 'X'></#if>
+  <@assertEquals actual=((x!'-') == '-') expected=(i < 3) />
+</#list>
+
+<#macro attemptTest>
+  <#attempt>
+    ${fails}
+  <#recover>
+    <@assert test=isNonFastIREMessage(.error) />
+  </#attempt>
+</#macro>
+<@attemptTest />
+${(callMacroFromExpression(attemptTest))!}
+
+<#macro interpretTest><@'$\{fails}'?interpret /></#macro>
+<#attempt>
+  <@interpretTest />
+<#recover>
+  <@assert test=isNonFastIREMessage(.error) />
+</#attempt>
+<#attempt>
+  ${(callMacroFromExpression(interpretTest))!}
+<#recover>
+  <@assert test=isNonFastIREMessage(.error) />
+</#attempt>
+
+<@assertEquals actual='fails'?eval!'-' expected='-' />
+<@assertEquals actual=('fails')?eval!'-' expected='-' />
+
+<#macro isIRE><@assertFails exception="InvalidReferenceException"><#nested></@></#macro>
+<#macro isNonFastIRE><@assertFails exception="InvalidReferenceException" message="Tip:"><#nested></@></#macro>
+<#function isNonFastIREMessage msg><#return msg?contains('Tip:') && msg?contains('null or missing')></#function>
+<#function callMacroFromExpression m>
+  <#local captured><@m /></#local>
+  <#return captured>
+</#function>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashconcat.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashconcat.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashconcat.ftl
new file mode 100644
index 0000000..127d828
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashconcat.ftl
@@ -0,0 +1,60 @@
+[#ftl]
+[#--
+  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.
+--]
+[#assign a = {"a":1, "b":2, "c":3, "X": 4}]
+[#assign b = {"d":10, "e":20, "f":30, "X": 40}]
+
+a:
+[@dump a /]
+
+B:
+[@dump b /]
+
+a + B:
+[@dump a + b /]
+
+B + a:
+[@dump b + a /]
+
+a + a:
+[@dump a + a /]
+
+{} + a:
+[@dump {} + a /]
+
+a + {}:
+[@dump a + {} /]
+
+{} + {}:
+[@dump {} + {} /]
+
+a + b + {} + b + {} + a:
+[@dump a + b + {} + b + {} + a /]
+
+
+[#macro dump s]
+[#list s?keys as k]
+  ${k} = ${s[k]}
+[/#list]
+  ---
+[#list s?values as v]
+  ${v}
+[/#list]
+  ---
+[/#macro]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashliteral.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashliteral.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashliteral.ftl
new file mode 100644
index 0000000..0a02a3a
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/hashliteral.ftl
@@ -0,0 +1,100 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Hash Literal Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${message}</p>
+
+<p>Now perform a hash assignment:</p>
+
+<#assign mymessage = "hello", foo="bar", one="1">
+<#assign test = { "test1": "test23", 
+                 "test45" : message, 
+                  mymessage : "hello all", 
+                  foo: one}>
+
+${test.test1}
+${test.test45}
+${test.hello}
+${test.bar}
+
+<p>Now update the assignment and repeat:</p>
+
+<#assign mymessage = "world">
+
+${test.test1}
+${test.test45}
+${test.hello}
+
+${test.bar}
+
+<p>Now reassign the list and repeat:</p>
+
+<#assign hash= {"temp" : "Temporary"}>
+<#assign test = { "test1" : "test23", 
+                        "test45" : message, 
+                        mymessage : "hello all", 
+                        foo : one, 
+                        "hash" : hash[ "temp" ], 
+                        "true" : hash.temp, 
+                        "newhash" : hash}>
+
+${test.test1}
+${test.test45}
+${test.hello?if_exists}
+
+${test.bar}
+${test.hash}
+${test.true}
+${test.newhash.temp}
+
+<p>Pathological case: zero item hash:</p>
+
+<#assign test = {}>
+${test.test1?if_exists}
+
+<p>Hash of number literals:</p>
+<#assign test = {"1" : 2}>
+${test["1"]}
+
+<p>Hash concatenation:</p>
+<#assign cc = { "a" : 1, "b" : 2 } + { "b" : 3, "c" : 4 }>
+<#list cc?keys?sort as key>
+${key} => ${cc[key]}
+</#list>
+
+<p>Empty hash concatenation:</p>
+${({} + { "a" : "foo" }).a}, ${({ "a" : "bar" } + {}).a}
+
+</body>
+</html>
+<@noOutput>
+
+<#assign m = { 'a': 1, 'b', 2, 'a': 3 }>
+<@assertEquals expected="a, b" actual=m?keys?join(', ') />
+<@assertEquals expected="3, 2" actual=m?values?join(', ') />
+<@assertEquals expected=3 actual=m['a'] />
+<@assertEquals expected=2 actual=m['b'] />
+
+</@noOutput>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/helloworld.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/helloworld.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/helloworld.ftl
new file mode 100644
index 0000000..91816f6
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/helloworld.ftl
@@ -0,0 +1,30 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Exec Model Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${exec( "java freemarker.test.HelloWorld" )}</p>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-escaping.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-escaping.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-escaping.ftl
new file mode 100644
index 0000000..9b39235
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-escaping.ftl
@@ -0,0 +1,81 @@
+<#--
+  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.
+-->
+<#macro m\-a data\-color>
+    <#local \.namespace = 123>
+    <a-b>${data\-color}<#nested \.namespace></a-b><#t>
+</#macro>
+<#macro "m-b2"></#macro>
+<#macro "m/b2"></#macro>
+
+<@m\-a data\-color="red"; loop\-var>${loop\-var}</@>
+
+<#function f\-a p\-a>
+    <#return p\-a + " works">
+</#function>
+${f\-a("f-a")}
+
+<#assign \-\-\-\.\: = 'dash-dash-dash etc.'>
+${\-\-\-\.\:}
+${.vars['---.:']}
+<#assign hash = { '--moz-prop': 'propVal' }>
+${hash.\-\-moz\-prop}
+${hash['--moz-prop']}
+
+<#assign ls\:a = 1..3>
+List: <#list ls\:a as \:i>${\:i}</#list>
+
+<#assign sw\-a=1>
+Switch: <#switch sw\-a>
+    <#case 1>OK<#break>
+    <#default>Fails
+</#switch>
+
+<#escape \-x as \-x?upper_case>${'escaped'}</#escape>
+
+<#if false && sw\-a == 1>
+    <#visit x\-y2 using x\-y1>
+    <#recurse x\-y2 using x\-y1>
+    <#import i\-a as i\-b>
+    <#include i\-c>
+</#if>
+
+<#assign @as@_a = 'as1'>
+${@as@_a}
+<#assign 'as-c' = 'as2'>
+${.vars['as-c']}
+<#assign "as/b" = 'as3'>
+${.vars["as/b"]}
+<#assign "as'c" = 'as4'>
+${.vars["as'c"]}
+<#assign 'as"d' = 'as5'>
+${.vars['as"d']}
+
+<#global g\-a=1 g\-b=2 "g-c"=3>
+
+<#macro catchAll x y attrs...>
+<catchAll x=${x} y=${y}<#list attrs?keys?sort as k> ${k}=${attrs[k]}</#list> />
+</#macro>
+<@catchAll x=1 y=2 z=3 data\-foo=4 a\:b\.c=5 />
+
+<#macro dumpNS>
+    <#list .namespace?keys?sort as k>
+        ${k} = <#local v = .namespace[k]><#if v?is_string>${v}<#else>...</#if><#lt>
+    </#list>
+</#macro>
+<@dumpNS />

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-non-ascii.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-non-ascii.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-non-ascii.ftl
new file mode 100644
index 0000000..59a4b0e
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/identifier-non-ascii.ftl
@@ -0,0 +1,21 @@
+<#--
+  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.
+-->
+<#macro árvíztűrőTükörfúrógép טֶקסט>${טֶקסט}</#macro>
+<#assign 한국어_키보드="Korean Keyboard">
+<@árvíztűrőTükörfúrógép 한국어_키보드 />
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/if.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/if.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/if.ftl
new file mode 100644
index 0000000..97c3f4b
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/if.ftl
@@ -0,0 +1,109 @@
+<#--
+  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.
+-->
+<#assign x = 1>
+
+- <#if x == 1>good</#if>
+- <#if x == 1></#if>good
+- <#if x == 1>goo${missing!'d'}</#if>
+- <#if x == 0>wrong</#if>good
+
+- <#if x == 1>good<#else>wrong</#if>
+- <#if x == 0>wrong<#else>good</#if>
+
+- <#if x == 1>good<#elseif x == 2>wrong<#else>wrong</#if>
+- <#if x == 1>good<#elseif x == 1>wrong<#else>wrong</#if>
+- <#if x == 0>wrong<#elseif x == 1>good<#else>wrong</#if>
+- <#if x == 0>wrong<#elseif x == 2>wrong<#else>good</#if>
+
+- <#if x == 1>good<#elseif x == 1>wrong</#if>
+- <#if x == 0>wrong<#elseif x == 1>good</#if>
+- <#if x == 0>wrong<#elseif x == 2>wrong</#if>good
+- <#if x == 0>wrong<#elseif x == 1><#else>wrong</#if>good
+
+<#-- Same with pre-calculable results, just in case later the dead code will be optimized out: -->
+- <#if 1 == 1>good</#if>
+- <#if 1 == 0>wrong</#if>good
+- <#if 1 == 1>goo${missing!'d'}</#if>
+- <#if 1 == 0>wrong</#if>good
+
+- <#if 1 == 1>good<#else>wrong</#if>
+- <#if 1 == 0>wrong<#else>good</#if>
+
+- <#if 1 == 1>good<#elseif 1 == 2>wrong<#else>wrong</#if>
+- <#if 1 == 1>good<#elseif 1 == 1>wrong<#else>wrong</#if>
+- <#if 1 == 0>wrong<#elseif 1 == 1>good<#else>wrong</#if>
+- <#if 1 == 0>wrong<#elseif 1 == 2>wrong<#else>good</#if>
+
+- <#if 1 == 1>good<#elseif 1 == 1>wrong</#if>
+- <#if 1 == 0>wrong<#elseif 1 == 1>good</#if>
+- <#if 1 == 0>wrong<#elseif 1 == 2>wrong</#if>good
+- <#if 1 == 0>wrong<#elseif 1 == 1><#else>wrong</#if>good
+
+<#-- Varying branch choice of the same AST nodes: -->
+<#list [1, 2, 3, 4] as x>
+- <#if x == 1>1</#if>
+- <#if x == 2>2</#if>
+- <#if x == 3>3</#if>
+- <#if x == 1>is 1<#else>isn't 1</#if>
+- <#if x == 2>is 2<#else>isn't 2</#if>
+- <#if x == 3>is 3<#else>isn't 3</#if>
+- Finally, it's: <#if x == 1>1<#elseif x == 2>2<#elseif x == 3>3<#else>4</#if>
+</#list>
+
+<#-- nested -->
+<#list [1, 2, 3] as x><#list [1, 2, 3] as y>
+  <#assign y = x * x>
+  <#if x == 1>
+    1:
+    <#if (x > y)>
+      > ${y}
+    <#elseif x == y>
+      == ${y}
+    <#else>
+      <= ${y}
+    </#if>
+  <#elseif x == 2>
+    2:
+    <#if (x > y)>
+      > ${y}
+    <#elseif x == y>
+      == ${y}
+    <#else>
+      <= ${y}
+    </#if>
+  <#else>
+    3:
+    <#if (x > y)>
+      > ${y}
+    <#elseif x == y>
+      == ${y}
+    <#else>
+      <= ${y}
+    </#if>
+    <#if x == 3 && y == 3>
+      End
+    </#if>
+  </#if>
+</#list></#list>
+
+<#-- parsing errors -->
+<@assertFails message="valid #if-#elseif-#else"><@"<#if t><#else><#elseif t2></#if>"?interpret /></@>
+<@assertFails message="valid #if-#elseif-#else"><@"<#if t><#else><#else></#if>"?interpret /></@>
+<@assertFails message="valid #if-#elseif-#else"><@"<#else></#else>"?interpret /></@>
+<@assertFails message="valid #if-#elseif-#else"><@"<#elseif t></#elseif>"?interpret /></@>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import.ftl
new file mode 100644
index 0000000..bddd857
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import.ftl
@@ -0,0 +1,45 @@
+<#--
+  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.
+-->
+--
+<#-- import "/import_lib.ftl" as my -->
+--
+
+<#if mail?exists || test?exists>
+  <#stop "mail or test should not exist">
+</#if>
+
+${my.mail}
+<@my.test foo="bar"/>
+
+<#assign mail="jsmith@other1.com">
+${my.mail}
+<@my.test foo="bar"/>
+
+<#assign mail in my>
+  jsmith@other2.com<#t>
+</#assign>
+${my.mail}
+<@my.test foo="bar"/>
+
+<#import "/import_lib.ftl" as my2>
+${my2.mail}
+<#assign mail="jsmith@other3.com" in my2>
+${my.mail}
+
+${my2.doubleUp("foobar")}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import_lib.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import_lib.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import_lib.ftl
new file mode 100644
index 0000000..3329af9
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/import_lib.ftl
@@ -0,0 +1,31 @@
+<#--
+  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.
+-->
+<#macro test foo>
+  Test ${foo}.
+  Email: ${mail}
+  <#if .main.mail?exists>
+    Email in the root: ${.main.mail}
+  </#if>
+</#macro>
+
+<#function doubleUp foo>
+   <#return foo+foo>
+</#function>
+
+<#assign mail = "jsmith@acme.com">
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include.ftl
new file mode 100644
index 0000000..3e997e7
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include.ftl
@@ -0,0 +1,47 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Include Instruction Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+${message}
+
+<#if message?exists>
+	<p>Message exists!
+</#if>
+
+<p>Test normal includes:</p>
+<#include "included.ftl">
+
+${foo}
+${nestedMessage}
+
+<@twice>
+Kilroy
+</@twice>
+
+<p>Test subdir includes:</p>
+<#include "subdir/include-subdir.ftl">
+</body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2-included.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2-included.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2-included.ftl
new file mode 100644
index 0000000..db9dfc1
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2-included.ftl
@@ -0,0 +1,19 @@
+<#--
+  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.
+-->
+${'A'} próba

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2.ftl
new file mode 100644
index 0000000..5f3ccc3
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/include2.ftl
@@ -0,0 +1,32 @@
+<#--
+  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.
+-->
+<#include "include2" + "-included.ftl">
+<#assign s = "de">
+<#include "inclu" + s + "2-included.ftl">
+
+<#assign bTrue=true>
+<#assign bFalse=false>
+<#include "include2-included.ftl" ignore_missing=true>
+<#include "include2-included.ftl" ignore_missing=bTrue>
+<#include "include2-included.ftl" ignore_missing=false>
+<#include "include2-included.ftl" ignore_missing=bFalse>
+
+<@assertFails message="not found"><#include "missing.ftl"></@>
+[<#include "missing.ftl" ignore_missing=true>]
+[<#include "missing.ftl" ignore_missing=bTrue>]

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/included.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/included.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/included.ftl
new file mode 100644
index 0000000..f711a67
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/included.ftl
@@ -0,0 +1,30 @@
+<#--
+  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.
+-->
+<p>A test of included files:</p>
+
+<#if .globals.message?exists>
+	<p>Message exists!:<br />
+        ${.globals.message}</p>
+<#else>
+        <p>No message :(</p>
+</#if>
+
+<#assign foo="assigning from included template", bar=" Can you see me? ">
+<#macro twice><#nested/>${bar}<#nested/></#macro>
+<#include "nestedinclude.ftl">

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/interpret.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/interpret.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/interpret.ftl
new file mode 100644
index 0000000..41f8425
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/interpret.ftl
@@ -0,0 +1,25 @@
+<#--
+  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.
+-->
+<#global x=["a", "b", "c"]>
+<#global templateSource = r"<#list x as y>${y}</#list>">
+<@templateSource?interpret>def</@>
+<@[templateSource]?interpret>def</@>
+<@[templateSource,"id"]?interpret>def</@>
+
+<#assign t = '<#macro m>M</#macro>'?interpret><@t /><@m/>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/iterators.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/iterators.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/iterators.ftl
new file mode 100644
index 0000000..389abf3
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/iterators.ftl
@@ -0,0 +1,71 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: List Iterator Test</title>
+</head>
+<body>
+<#assign list= ["one", "two", "three", "four", "five"]>
+<#assign hash = {"key", list}>
+<#assign  hash2 = {"value", hash}>
+
+<p>A simple test follows:</p>
+
+<p>${message}</p>
+
+<p>Now iterate over a list:</p>
+
+<#list list as item>
+<p>${item}</p>
+</#list>
+
+<p>Now iterate again:</p>
+
+<#list list as item>
+<p>${item_index}. ${item}</p>
+</#list>
+
+<p>Iterate over a list in a hash:</p>
+
+<#list hash.key as item>
+<p>${item}</p>
+</#list>
+
+<#list hash.key as item>
+<p>${item}</p>
+</#list>
+
+<#list hash[ "key" ] as item>
+<p>${item}</p>
+</#list>
+
+<#list hash["key"] as item>
+<p>${item}</p>
+</#list>
+
+<#list hash2["value"].key as key>
+<p>${key}</p>
+</#list>
+
+<#list hash2.value.key as az>
+<p>${az}</p>
+</#list>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/lastcharacter.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/lastcharacter.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/lastcharacter.ftl
new file mode 100644
index 0000000..e762356
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/lastcharacter.ftl
@@ -0,0 +1,31 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: Last Character Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+  
+    #{message?capitalize?length}
+    
+    ${message [1..] ? upper_case}
+    
+    message: ${message ?capitalize[0..10]}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list-bis.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list-bis.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list-bis.ftl
new file mode 100644
index 0000000..e52307f
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list-bis.ftl
@@ -0,0 +1,48 @@
+<#--
+  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.
+-->
+<#list ['a', 'b', 'c'] as x>
+    ${x?index}: ${x} [<#list ['A', 'B', 'C'] as x>${x?index}:${x}<#sep>, </#list>]
+</#list>
+
+<#list ['a', 'b', 'c'] as i>
+    ${i?index}: ${i} <#list ['A', 'B', 'C'] as j>${i?index}${i}/${j?index}${j}<#sep>, </#list>
+</#list>
+
+<#list ['a', 'b', 'c']><#items as x>${x?index}:${x}<#sep>, </#items></#list>
+<#list ['a', 'b', 'c']><#items as x>${x?counter}. ${x};<#sep> </#items></#list>
+
+<#list ['a', 'b', 'c'] as x>${x}<#if x?hasNext>, </#if></#list>
+<#list ['a', 'b', 'c'] as x\-y>${x\-y}<#if x\-y?hasNext>, </#if></#list>
+
+<#list ['a', 'b', 'c'] as x><#if x?isFirst>${x?capFirst}<#else>${x}</#if><#sep>, </#sep><#if x?isLast>.</#if></#list>
+
+<#list ['a', 'b', 'c'] as x>${x?isOddItem?c}/${x?isEvenItem?c}<#sep> </#list>
+
+<#list ['a', 'b', 'c'] as x>
+    <td class="${x?itemParity}Row">${x}</td>
+</#list>
+
+<#list ['a', 'b', 'c'] as x>
+    <td class="row${x?itemParityCap}">${x}</td>
+</#list>
+
+<#list ['a', 'b', 'c', 'd', 'e', 'f', 'g'] as x>
+    <td class="${x?itemCycle('R', 'G', 'B')}">${x}</td>
+</#list>
+<@assertFails message="expects 1"><#list 1..1 as x>${x?itemCycle()}</#list></@>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list.ftl
new file mode 100644
index 0000000..280491c
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list.ftl
@@ -0,0 +1,44 @@
+<#--
+  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.
+-->
+<@testList ["aardvark", "bear", "cat", "dog"] />
+
+<@testList ["aardvark"] />
+
+<@testList [] />
+
+<@testList listables.list />
+
+<@testList listables.linkedList />
+
+<@testList listables.set />
+
+<@testList listables.iterator />
+
+<@testList listables.emptyList />
+
+<@testList listables.emptyLinkedList />
+
+<@testList listables.emptySet />
+
+<@testList listables.emptyIterator />
+
+<#macro testList seq>
+Size: <#attempt>${seq?size}<#recover>failed</#attempt>
+Items: <#list seq as i>@${i_index} ${i}<#if i_has_next>, <#else>.</#if></#list>
+</#macro>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
new file mode 100644
index 0000000..db64a4b
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
@@ -0,0 +1,90 @@
+<#--
+  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.
+-->
+<@testList ["aardvark", "bear", "cat", "dog"] />
+
+<@testList ["aardvark"] />
+
+<@testList [] />
+
+<@testList listables.list />
+
+<@testList listables.set />
+
+<@testList listables.getIterator />
+
+<@testList listables.emptyList />
+
+<@testList listables.emptySet />
+
+<@testList listables.getEmptyIterator />
+
+<#macro testList xs>
+=== [${resolve(xs)?join(", ")}] ===
+<#assign resolveCallCnt = 0>
+
+-- List+sep:
+<#list resolve(xs) as x>
+    ${x}<#sep>,</#sep>
+</#list>
+-- List+else:
+<#list resolve(xs) as x>
+    ${x}
+<#else>
+    Empty!
+</#list>
+-- List+items:
+<#list resolve(xs)>
+    [
+    <#items as x>
+        ${x!'U'}
+    </#items>
+    ]
+</#list>
+-- List+items+else:
+<#list resolve(xs)>
+    [
+    <#items as x>
+        ${x!'U'}
+    </#items>
+    ]
+<#else>
+    Empty!
+</#list>
+-- List+items+sep+else:
+<#list resolve(xs)>
+    [
+    <#items as x>
+        ${x!'U'}<#sep>,</#sep>
+    </#items>
+    ]
+<#else>
+    Empty!
+</#list>
+<@assertEquals expected=5 actual=resolveCallCnt />
+--
+</#macro>
+
+<#function resolve xs>
+    <#assign resolveCallCnt = (resolveCallCnt!0) + 1>
+    <#if xs?isMethod>
+        <#return xs()>
+    <#else>
+        <#return xs>
+    </#if>
+</#function>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list3.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list3.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list3.ftl
new file mode 100644
index 0000000..d2fcf71
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list3.ftl
@@ -0,0 +1,70 @@
+<#--
+  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.
+-->
+[
+<#list listables.list as i>
+    [<#list listables.list as j>(${i}@${i_index}, ${j}@${j_index})<#sep>, </#sep></#list>]<#sep>,</#sep>
+</#list>
+]
+
+<#macro hits xs style="">
+    <#list xs>
+        <p>${xs?size} hits:
+        <div class="hits">
+            <#switch style>
+                <#case "hidden">
+                    ...
+                    <#break>
+                <#case "other">
+                    <#items as x>
+                        <div class="hitOther">${x}</div>
+                    </#items>
+                    <#break>
+                <#case "none">
+                <#default>
+                    <#items as x>
+                        <div class="hit">${x}</div>
+                    </#items>
+                    <#break>
+            </#switch>
+        </div>
+    <#else>
+        <p>Nothing.
+    </#list>
+</#macro>
+
+<@hits ['a', 'b'] />
+
+<@hits ['a', 'b'], "other" />
+
+<@hits ['a', 'b'], "hidden" />
+
+<@hits [] />
+
+<#list listables.list as i><#if i_index gt 1>...<#break></#if>${i}<#sep>, </#sep></#list>
+<#list listables.list>[<#items as i><#if i_index gt 1>...<#break></#if>${i}<#sep>, </#sep></#items>]</#list>
+
+<@testAutoClosedSep 1..3 />
+<@testAutoClosedSep [1] />
+<@testAutoClosedSep [] />
+
+<#macro testAutoClosedSep xs>
+<#list xs as x>${x}<#sep>, <#else>Empty</#list>
+<#list xs as x>${x}<#sep><#if x_index == 0> /*first*/, <#else>, </#if><#else>Empty</#list>
+<#list xs>[<#items as x>${x}<#sep>, </#items>]<#else>Empty</#list>
+</#macro>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhash.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhash.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhash.ftl
new file mode 100644
index 0000000..6f22b43
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhash.ftl
@@ -0,0 +1,70 @@
+<#--
+  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.
+-->
+<#setting booleanFormat='Y,N'>
+
+<#macro listings maps>
+  <#list maps as m>
+    Map:
+    
+    [
+    <#list m as k, v>
+      ${k!'null'} = ${v!'null'}
+    </#list>
+    ]
+  
+    [
+    <#list m as k, v>
+      ${k!'null'} = ${v!'null'}<#sep>;</#sep> // @${k?index}=@${v?index}; ${k?itemParity}=${v?itemParity}; ${k?hasNext}=${v?hasNext}
+    <#else>
+      Empty
+    </#list>
+    ]
+  
+    {
+    <#list m>
+      [
+      <#items as k, v>
+        ${k!'null'} = ${v!'null'}<#sep>;</#sep> // @${k?index}=@${v?index}; ${k?itemParity}=${v?itemParity}; ${k?hasNext}=${v?hasNext}
+      </#items>
+      ]
+    <#else>
+      Empty
+    </#list>
+    }
+
+  </#list>
+</#macro>
+
+Non-empty maps:
+
+<@listings listables.hashEx2s />
+<@listings [ listables.hashNonEx2 ] />
+
+Empty maps:
+
+<@listings listables.emptyHashes />
+
+<#list { 'a': { 'aa': 11 }, 'b': { 'ba': 21, 'bb': 22 }, 'c': {} } as k1, v1>
+  ${k1} @ ${k1?index}, ${v1?size}
+  <#list v1 as k2, v2>
+    ${k2} = ${v2}  @ ${k2?index} // inside ${k1} @ ${k1?index}, ${v1?size}
+  </#list>
+  ${k1} @ ${k1?index}, ${v1?size}
+  --
+</#list>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhashliteral.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhashliteral.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhashliteral.ftl
new file mode 100644
index 0000000..06694c9
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listhashliteral.ftl
@@ -0,0 +1,35 @@
+<#--
+  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.
+-->
+<#list [ { "a": 1, "b": 2, "a": 3 }, { } ] as h>
+  KVPs:
+  <#list h as k, v>
+    ${k} = ${v}
+  </#list>
+  
+  Keys:
+  <#list h?keys as k>
+    ${k}
+  </#list>
+  
+  Values:
+  <#list h?values as v>
+    ${v}
+  </#list>
+
+</#list>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listliteral.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listliteral.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listliteral.ftl
new file mode 100644
index 0000000..d48578c
--- /dev/null
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/listliteral.ftl
@@ -0,0 +1,84 @@
+<#--
+  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.
+-->
+<html>
+<head>
+<title>FreeMarker: List Literal Test</title>
+</head>
+<body>
+
+<p>A simple test follows:</p>
+
+<p>${message}</p>
+
+<p>Now perform a list assignment:</p>
+
+<#assign hash = {"temp", "Temporary"}>
+<#assign mymessage = "hello">
+<#assign test = [ "test1", "test23", "test45", message, mymessage]>
+
+The list contains #{test?size} items.
+
+<#list test as item>
+<p>${item}</p>
+</#list>
+
+<p>Now update the assignment and repeat:</p>
+
+<#assign mymessage = "world">
+
+<#list test as item>
+<p>${item}</p>
+</#list>
+
+<p>Now reassign the list and repeat:</p>
+
+<#assign test = [ hash.temp, "test1", "test23", "test45", mymessage, "hash", hash["temp"]]>
+<#assign test = [ "foo", "bar" ] + test>
+
+<#list test[1..4] as item>
+<p>${item}</p>
+</#list>
+
+<p>Silly, but necessary tests, for one and zero element lists:</p>
+
+<#assign test = [ "Hello, world" ]>
+
+<#list test as item>
+<p>${item}</p>
+</#list>
+
+<p>Zero item test:</p>
+
+<#assign test = []>
+
+<#list test as item>
+<p>${item}</p>
+</#list>
+
+<p>Dumb test for number literals -- these weren't working as expected:</p>
+
+<#assign test = [] + [1, 2,3, 5, 7]>
+
+<#list test as item>
+<p>${item}</p>
+<#if item == 5><#break></#if>
+</#list>
+
+</body>
+</html>



Mime
View raw message