Repository: incubator-freemarker Updated Branches: refs/heads/3 3187a094e -> 051a08223
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/expected/beans.txt ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/expected/beans.txt b/src/test/resources/org/apache/freemarker/test/templatesuite/expected/beans.txt deleted file mode 100644 index ab41e26..0000000 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/expected/beans.txt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -array-0 -array-1 -2 -array-0 -array-1 -list-0 -list-1 -list-2 -3 -not empty -list-0 -value -objValue -foo-value -hasfoo -nobaz -bar-value-0 -bar-value-0 -foo-value -overloaded-int-1 -overloaded-String-String -Message -1974-11-14 -static-method -static-overloaded-int-1 -static-overloaded-String-String -static-final-field -static-field -ONEx -TWOx -THREEx -true -false -false -42 -1 -m - http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/expected/default-object-wrapper.txt ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/expected/default-object-wrapper.txt b/src/test/resources/org/apache/freemarker/test/templatesuite/expected/default-object-wrapper.txt new file mode 100644 index 0000000..ab41e26 --- /dev/null +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/expected/default-object-wrapper.txt @@ -0,0 +1,56 @@ +/* + * 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. + */ +array-0 +array-1 +2 +array-0 +array-1 +list-0 +list-1 +list-2 +3 +not empty +list-0 +value +objValue +foo-value +hasfoo +nobaz +bar-value-0 +bar-value-0 +foo-value +overloaded-int-1 +overloaded-String-String +Message +1974-11-14 +static-method +static-overloaded-int-1 +static-overloaded-String-String +static-final-field +static-field +ONEx +TWOx +THREEx +true +false +false +42 +1 +m + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/expected/listhash.txt ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/expected/listhash.txt b/src/test/resources/org/apache/freemarker/test/templatesuite/expected/listhash.txt index c713195..15b2efe 100644 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/expected/listhash.txt +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/expected/listhash.txt @@ -84,37 +84,6 @@ Non-empty maps: Map: [ - k1 = v1 - 2 = v2 - k3 = v3 - null = v4 - Y = v5 - N = null - ] - - [ - k1 = v1; // @0=@0; odd=odd; Y=Y - 2 = v2; // @1=@1; even=even; Y=Y - k3 = v3; // @2=@2; odd=odd; Y=Y - null = v4; // @3=@3; even=even; Y=Y - Y = v5; // @4=@4; odd=odd; Y=Y - N = null // @5=@5; even=even; N=N - ] - - { - [ - k1 = v1; // @0=@0; odd=odd; Y=Y - 2 = v2; // @1=@1; even=even; Y=Y - k3 = v3; // @2=@2; odd=odd; Y=Y - null = v4; // @3=@3; even=even; Y=Y - Y = v5; // @4=@4; odd=odd; Y=Y - N = null // @5=@5; even=even; N=N - ] - } - - Map: - - [ k1 = 11 k2 = 22 ] @@ -173,19 +142,6 @@ Empty maps: Empty } - Map: - - [ - ] - - [ - Empty - ] - - { - Empty - } - a @ 0, 1 aa = 11 @ 0 // inside a @ 0, 1 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/templates/api-builtins.ftl ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/api-builtins.ftl b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/api-builtins.ftl index ce5fc9f..c915104 100644 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/api-builtins.ftl +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/api-builtins.ftl @@ -30,17 +30,11 @@ </#list> <@assertEquals expected="1: a, 2: b, 3: c" actual=dump /> -<#assign bw = testName?ends_with("-bw")> - <@assert test=map?has_api /> <@assert test=list?has_api /> <@assert test=set?has_api /> -<@assert test = bw == s?has_api /> +<@assert test=!s?has_api /> <@assert test=!1?has_api /> <@assert test=!""?has_api /> <@assert test=!{}?has_api /> <@assert test=!true?has_api /> - -<#if bw> - <@assertEquals expected="TEST" actual=s?api.toUpperCase() /> -</#if> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/templates/bean-maps.ftl ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/bean-maps.ftl b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/bean-maps.ftl deleted file mode 100644 index e8651b8..0000000 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/bean-maps.ftl +++ /dev/null @@ -1,58 +0,0 @@ -[#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. ---] - - -[#macro test hash desc] -${desc} (${hash?size}): - [#list hash?keys?sort as key] - ${key}[#list 0 .. (16 - key?length) as x] [/#list]: [@print value=hash[key]/] - [/#list] -[/#macro] - - -[#macro print value="DEBUGME"] - [#if value?is_number || value?is_string] - ${value}[#t] - [#elseif value?is_boolean] - [#if value]true[#else]false[/#if][#t] - [#else] - UNKNOWN[#t] - [/#if] -[/#macro] -[@test hash=m1 desc="properties only, shadow"/] - -[@test hash=m2 desc="properties only"/] - -[@test hash=m3 desc="nothing, shadow"/] - -[@test hash=m4 desc="nothing"/] - -[@test hash=m5 desc="all, shadow"/] - -[@test hash=m6 desc="all"/] - -[@test hash=m7 desc="simple map mode"/] - - -String concatenation: - ${s1 + s2} - ${s3 + s4} - ${s1 + s3} - ${s2 + s4} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/templates/beans.ftl ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/beans.ftl b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/beans.ftl deleted file mode 100644 index 3b29c62..0000000 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/beans.ftl +++ /dev/null @@ -1,60 +0,0 @@ -<#-- - 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()} -<#if list.isEmpty()>empty<#else>not empty</#if> -${list[0]} -${map.key} -${map(objKey)} -${obj.foo} -<#if obj.foo?exists>hasfoo<#else>nofoo</#if> -<#if obj.baz?exists>hasbaz<#else>nobaz</#if> -${obj.bar[0]} -${obj.bar(0)} -${obj.getFoo()} -${obj.overloaded(1?int)} -${obj.overloaded("String")} -${resourceBundle.message} -${resourceBundle("format", date)} -<#assign static = statics["org.apache.freemarker.test.templatesuite.models.BeanTestClass"]> -${static.staticMethod()} -${static.staticOverloaded[1]} -${static.staticOverloaded("String")} -${static.STATIC_FINAL_FIELD} -${static.STATIC_FIELD} -<#assign enum = enums["org.apache.freemarker.test.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.test.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/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/templates/default-object-wrapper.ftl ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/default-object-wrapper.ftl b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/default-object-wrapper.ftl new file mode 100644 index 0000000..d44f26e --- /dev/null +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/default-object-wrapper.ftl @@ -0,0 +1,60 @@ +<#-- + 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.bar(0)} +${obj.getFoo()} +${obj.overloaded(1?int)} +${obj.overloaded("String")} +${resourceBundle.message} +${resourceBundle("format", date)} +<#assign static = statics["org.apache.freemarker.test.templatesuite.models.BeanTestClass"]> +${static.staticMethod()} +${static.staticOverloaded[1]} +${static.staticOverloaded("String")} +${static.STATIC_FINAL_FIELD} +${static.STATIC_FIELD} +<#assign enum = enums["org.apache.freemarker.test.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.test.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/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/templates/overloaded-methods.ftl ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/overloaded-methods.ftl b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/overloaded-methods.ftl index 2d85dcc..8cf116f 100644 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/templates/overloaded-methods.ftl +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/templates/overloaded-methods.ftl @@ -19,9 +19,7 @@ <@assertEquals actual=obj.mStringArrayVsListPreference(obj.javaStringList) expected="mStringArrayVsListPreference(List [a, b])" /> <@assertEquals actual=obj.mStringArrayVsListPreference(obj.javaStringArray) expected="mStringArrayVsListPreference(String[] [a, b])" /> -<#if dow> - <@assertEquals actual=obj.mStringArrayVsListPreference(obj.javaObjectArray) expected="mStringArrayVsListPreference(List [a, b])" /> -</#if> +<@assertEquals actual=obj.mStringArrayVsListPreference(obj.javaObjectArray) expected="mStringArrayVsListPreference(List [a, b])" /> <#-- Check if non-overloaded calls still work; they share some code with overloaded methods: --> <@assertEquals actual=obj.mIntArrayNonOverloaded([1, 2, 3]) expected="mIntArrayNonOverloaded(int[] [1, 2, 3])" /> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/051a0822/src/test/resources/org/apache/freemarker/test/templatesuite/testcases.xml ---------------------------------------------------------------------- diff --git a/src/test/resources/org/apache/freemarker/test/templatesuite/testcases.xml b/src/test/resources/org/apache/freemarker/test/templatesuite/testcases.xml index c573c72..e3be657 100644 --- a/src/test/resources/org/apache/freemarker/test/templatesuite/testcases.xml +++ b/src/test/resources/org/apache/freemarker/test/templatesuite/testcases.xml @@ -56,23 +56,10 @@ Note that for the incompatible_improvements setting you can specify a list of ve <setting input_encoding="UTF-8" output_encoding="UTF-8" /> <testCase name="api-builtins" noOutput="true"> - <setting - object_wrapper="DefaultObjectWrapper(3.0.0)" - api_builtin_enabled="true" - /> - </testCase> - <testCase name="api-builtins[#endTN]-bw" noOutput="true"> - <setting - object_wrapper="BeansWrapper(3.0.0)" - api_builtin_enabled="true" - /> + <setting api_builtin_enabled="true" /> </testCase> <testCase name="arithmetic" /> <testCase name="assignments" noOutput="true" /> - <testCase name="bean-maps"/> - <testCase name="beans"> - <setting object_wrapper="beans"/> - </testCase> <testCase name="boolean" /> <testCase name="charset-in-header"> <setting clear_encoding_map="Y" input_encoding="ISO-8859-5" /> @@ -86,9 +73,10 @@ Note that for the incompatible_improvements setting you can specify a list of ve <testCase name="dateformat-iso-bi" noOutput="true" /> <testCase name="dateparsing" noOutput="true" /> <testCase name="default"/> - <testCase name="default-xmlns"> - <setting object_wrapper="beans"/> + <testCase name="default-object-wrapper"> + <setting api_builtin_enabled="true" /> </testCase> + <testCase name="default-xmlns" /> <testCase name="encoding-builtins" /> <testCase name="escapes" /> <testCase name="hashliteral" /> @@ -158,9 +146,6 @@ Note that for the incompatible_improvements setting you can specify a list of ve <testCase name="recover" /> <testCase name="root" /> <testCase name="setting" noOutput="true" /> - <testCase name="sequence-builtins[#endTN]-with-BeansWrapper" expected="sequence-builtins.txt"> - <setting object_wrapper="beans"/> - </testCase> <testCase name="sequence-builtins[#endTN]-with-SimpleTemplateModel" expected="sequence-builtins.txt"> <setting object_wrapper="org.apache.freemarker.test.util.SimpleMapAndCollectionObjectWrapper(3.0.0)" /> </testCase> @@ -190,22 +175,12 @@ Note that for the incompatible_improvements setting you can specify a list of ve <testCase name="variables"/> <testCase name="whitespace-trim"/> <testCase name="wstrip-in-header"/> - <testCase name="xml-fragment"> - <setting object_wrapper="beans"/> - </testCase> - <testCase name="xmlns1"> - <setting object_wrapper="beans"/> - </testCase> + <testCase name="xml-fragment" /> + <testCase name="xmlns1" /> <testCase name="xmlns2" template="xmlns1.ftl" expected="xmlns1.txt" /> - <testCase name="xmlns3"> - <setting object_wrapper="beans"/> - </testCase> - <testCase name="xmlns4"> - <setting object_wrapper="beans"/> - </testCase> - <testCase name="xmlns5"> - <setting object_wrapper="beans"/> - </testCase> + <testCase name="xmlns3" /> + <testCase name="xmlns4" /> + <testCase name="xmlns5" /> <testCase name="xml-ns_prefix-scope" template="xml-ns_prefix-scope-main.ftl" /> <testCase name="hashconcat"/> <testCase name="new-defaultresolver" /> @@ -230,16 +205,10 @@ Note that for the incompatible_improvements setting you can specify a list of ve <testCase name="number-math-builtins" noOutput="true" /> <testCase name="string-builtin-coercion" noOutput="true" /> - <testCase name="overloaded-methods[#endTN]-inc-bw" noOutput="true"> - <setting object_wrapper="org.apache.freemarker.core.model.impl.beans.BeansWrapperInc"/> - </testCase> - <testCase name="overloaded-methods[#endTN]-desc-bw" noOutput="true"> - <setting object_wrapper="org.apache.freemarker.core.model.impl.beans.BeansWrapperDesc"/> - </testCase> <testCase name="overloaded-methods[#endTN]-inc-dow" noOutput="true"> - <setting object_wrapper="org.apache.freemarker.core.model.impl.beans.DefaultObjectWrapperInc"/> + <setting object_wrapper="org.apache.freemarker.core.model.impl.DefaultObjectWrapperInc"/> </testCase> <testCase name="overloaded-methods[#endTN]-desc-dow" noOutput="true"> - <setting object_wrapper="org.apache.freemarker.core.model.impl.beans.DefaultObjectWrapperDesc"/> + <setting object_wrapper="org.apache.freemarker.core.model.impl.DefaultObjectWrapperDesc"/> </testCase> </testCases>
