Continued work on TemplateLanguage configuration and new file extensions: Renamed all *.ftl*-s (in tests) to the new file extensions.
Project: http://git-wip-us.apache.org/repos/asf/freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/freemarker/commit/81b48221 Tree: http://git-wip-us.apache.org/repos/asf/freemarker/tree/81b48221 Diff: http://git-wip-us.apache.org/repos/asf/freemarker/diff/81b48221 Branch: refs/heads/3 Commit: 81b4822147468b4a34d3a968e683686379cd67f6 Parents: e9ca9d4 Author: ddekany <ddek...@apache.org> Authored: Wed Apr 11 21:27:58 2018 +0200 Committer: ddekany <ddek...@apache.org> Committed: Thu Apr 12 19:16:20 2018 +0200 ---------------------------------------------------------------------- .../org/apache/freemarker/core/ASTTest.java | 4 +- .../freemarker/core/CanonicalFormTest.java | 12 +- .../freemarker/core/ConfigurationTest.java | 74 ++-- .../freemarker/core/EncodingOverrideTest.java | 4 +- .../core/TemplateLookupStrategyTest.java | 260 ++++++------ .../org/apache/freemarker/core/ast-1.f3ah | 29 ++ .../org/apache/freemarker/core/ast-1.ftl | 29 -- .../apache/freemarker/core/ast-assignments.f3ah | 29 ++ .../apache/freemarker/core/ast-assignments.ftl | 29 -- .../apache/freemarker/core/ast-builtins.f3ah | 23 ++ .../org/apache/freemarker/core/ast-builtins.ftl | 23 -- .../apache/freemarker/core/ast-locations.f3ah | 36 ++ .../apache/freemarker/core/ast-locations.ftl | 36 -- .../core/ast-mixedcontentsimplifications.f3ah | 26 ++ .../core/ast-mixedcontentsimplifications.ftl | 26 -- .../core/ast-multipleignoredchildren.f3ah | 33 ++ .../core/ast-multipleignoredchildren.ftl | 33 -- .../core/ast-nestedignoredchildren.f3ah | 19 + .../core/ast-nestedignoredchildren.ftl | 19 - .../org/apache/freemarker/core/ast-range.f3ah | 47 +++ .../org/apache/freemarker/core/ast-range.ftl | 47 --- .../core/ast-strlitinterpolation.f3ah | 25 ++ .../freemarker/core/ast-strlitinterpolation.ftl | 25 -- .../core/ast-whitespacestripping.f3ah | 40 ++ .../freemarker/core/ast-whitespacestripping.ftl | 40 -- .../freemarker/core/cano-assignments.f3ah | 35 ++ .../freemarker/core/cano-assignments.f3ah.out | 34 ++ .../apache/freemarker/core/cano-assignments.ftl | 35 -- .../freemarker/core/cano-assignments.ftl.out | 34 -- .../apache/freemarker/core/cano-builtins.f3ah | 23 ++ .../freemarker/core/cano-builtins.f3ah.out | 23 ++ .../apache/freemarker/core/cano-builtins.ftl | 23 -- .../freemarker/core/cano-builtins.ftl.out | 23 -- .../core/cano-identifier-escaping.f3au | 76 ++++ .../core/cano-identifier-escaping.f3au.out | 44 ++ .../core/cano-identifier-escaping.ftl | 76 ---- .../core/cano-identifier-escaping.ftl.out | 44 -- .../core/cano-macro-and-function.f3ah | 43 ++ .../core/cano-macro-and-function.f3ah.out | 42 ++ .../freemarker/core/cano-macro-and-function.ftl | 43 -- .../core/cano-macro-and-function.ftl.out | 42 -- .../core/cano-strlitinterpolation.f3ah | 19 + .../core/cano-strlitinterpolation.f3ah.out | 19 + .../core/cano-strlitinterpolation.ftl | 19 - .../core/cano-strlitinterpolation.ftl.out | 19 - .../core/encodingOverride-ISO-8859-1.f3ah | 20 + .../core/encodingOverride-ISO-8859-1.ftl | 20 - .../freemarker/core/encodingOverride-UTF-8.f3ah | 20 + .../freemarker/core/encodingOverride-UTF-8.ftl | 20 - .../freemarker/core/templateresolver/test.ftl | 19 - .../core/templatesuite/expected/include.txt | 6 +- .../core/templatesuite/expected/specialvars.txt | 2 +- .../templatesuite/templates/api-builtins.f3ac | 40 ++ .../templatesuite/templates/api-builtins.ftl | 40 -- .../templatesuite/templates/assignments.f3ac | 108 +++++ .../templatesuite/templates/assignments.ftl | 108 ----- .../templates/boolean-formatting.f3ac | 82 ++++ .../templates/boolean-formatting.ftl | 82 ---- .../core/templatesuite/templates/boolean.f3ac | 146 +++++++ .../core/templatesuite/templates/boolean.ftl | 146 ------- .../templates/charset-in-header.f3ac | 27 ++ .../templates/charset-in-header.ftl | 27 -- .../templates/charset-in-header_inc1.f3ac | 20 + .../templates/charset-in-header_inc1.ftl | 20 - .../templates/charset-in-header_inc2.f3ac | 19 + .../templates/charset-in-header_inc2.ftl | 19 - .../core/templatesuite/templates/comment.f3ac | 50 +++ .../core/templatesuite/templates/comment.ftl | 50 --- .../templatesuite/templates/comparisons.f3ac | 218 ++++++++++ .../templatesuite/templates/comparisons.ftl | 218 ---------- .../core/templatesuite/templates/compress.f3ac | 42 ++ .../core/templatesuite/templates/compress.ftl | 42 -- .../templates/date-type-builtins.f3ac | 47 +++ .../templates/date-type-builtins.ftl | 47 --- .../templates/dateformat-iso-bi.f3ac | 163 ++++++++ .../templates/dateformat-iso-bi.ftl | 163 -------- .../templates/dateformat-iso-like.f3ac | 155 +++++++ .../templates/dateformat-iso-like.ftl | 155 ------- .../templates/dateformat-java.f3ac | 75 ++++ .../templatesuite/templates/dateformat-java.ftl | 75 ---- .../templatesuite/templates/dateparsing.f3ac | 84 ++++ .../templatesuite/templates/dateparsing.ftl | 84 ---- .../templates/default-object-wrapper.f3ac | 59 +++ .../templates/default-object-wrapper.ftl | 59 --- .../core/templatesuite/templates/default.f3ac | 34 ++ .../core/templatesuite/templates/default.ftl | 34 -- .../templates/encoding-builtins.f3ac | 52 +++ .../templates/encoding-builtins.ftl | 52 --- .../core/templatesuite/templates/escapes.f3ac | 79 ++++ .../core/templatesuite/templates/escapes.ftl | 79 ---- .../core/templatesuite/templates/exception.f3ac | 31 ++ .../core/templatesuite/templates/exception.ftl | 31 -- .../templatesuite/templates/exception2.f3ac | 31 ++ .../core/templatesuite/templates/exception2.ftl | 31 -- .../templatesuite/templates/exception3.f3ac | 31 ++ .../core/templatesuite/templates/exception3.ftl | 31 -- .../templates/existence-operators.f3ac | 141 +++++++ .../templates/existence-operators.ftl | 141 ------- .../templatesuite/templates/hashconcat.f3ac | 60 +++ .../core/templatesuite/templates/hashconcat.ftl | 60 --- .../templatesuite/templates/hashliteral.f3ac | 100 +++++ .../templatesuite/templates/hashliteral.ftl | 100 ----- .../templatesuite/templates/helloworld.f3ac | 30 ++ .../core/templatesuite/templates/helloworld.ftl | 30 -- .../templates/identifier-escaping.f3ac | 81 ++++ .../templates/identifier-escaping.ftl | 81 ---- .../templates/identifier-non-ascii.f3ac | 21 + .../templates/identifier-non-ascii.ftl | 21 - .../core/templatesuite/templates/if.f3ac | 109 +++++ .../core/templatesuite/templates/if.ftl | 109 ----- .../core/templatesuite/templates/import.f3ac | 45 ++ .../core/templatesuite/templates/import.ftl | 45 -- .../templatesuite/templates/import_lib.f3ac | 31 ++ .../core/templatesuite/templates/import_lib.ftl | 31 -- .../core/templatesuite/templates/include.f3ac | 47 +++ .../core/templatesuite/templates/include.ftl | 47 --- .../templates/include2-included.f3ac | 19 + .../templates/include2-included.ftl | 19 - .../core/templatesuite/templates/include2.f3ac | 32 ++ .../core/templatesuite/templates/include2.ftl | 32 -- .../core/templatesuite/templates/included.f3ac | 30 ++ .../core/templatesuite/templates/included.ftl | 30 -- .../core/templatesuite/templates/interpret.f3ac | 26 ++ .../core/templatesuite/templates/interpret.ftl | 26 -- .../core/templatesuite/templates/iterators.f3ac | 71 ++++ .../core/templatesuite/templates/iterators.ftl | 71 ---- .../templatesuite/templates/lastcharacter.f3ac | 31 ++ .../templatesuite/templates/lastcharacter.ftl | 31 -- .../core/templatesuite/templates/list-bis.f3ac | 48 +++ .../core/templatesuite/templates/list-bis.ftl | 48 --- .../core/templatesuite/templates/list.f3ac | 44 ++ .../core/templatesuite/templates/list.ftl | 44 -- .../core/templatesuite/templates/list2.f3ac | 90 ++++ .../core/templatesuite/templates/list2.ftl | 90 ---- .../core/templatesuite/templates/list3.f3ac | 70 ++++ .../core/templatesuite/templates/list3.ftl | 70 ---- .../core/templatesuite/templates/listhash.f3ac | 69 ++++ .../core/templatesuite/templates/listhash.ftl | 69 ---- .../templates/listhashliteral.f3ac | 35 ++ .../templatesuite/templates/listhashliteral.ftl | 35 -- .../templatesuite/templates/listliteral.f3ac | 84 ++++ .../templatesuite/templates/listliteral.ftl | 84 ---- .../templatesuite/templates/localization.f3ac | 32 ++ .../templatesuite/templates/localization.ftl | 32 -- .../templates/localization_en.f3ac | 32 ++ .../templatesuite/templates/localization_en.ftl | 32 -- .../templates/localization_en_AU.f3ac | 32 ++ .../templates/localization_en_AU.ftl | 32 -- .../core/templatesuite/templates/logging.f3ac | 42 ++ .../core/templatesuite/templates/logging.ftl | 42 -- .../templatesuite/templates/loopvariable.f3ac | 49 +++ .../templatesuite/templates/loopvariable.ftl | 49 --- .../templatesuite/templates/macros-return.f3ac | 34 ++ .../templatesuite/templates/macros-return.ftl | 34 -- .../core/templatesuite/templates/macros.f3ac | 100 +++++ .../core/templatesuite/templates/macros.ftl | 100 ----- .../templatesuite/templates/multimodels.f3ac | 84 ++++ .../templatesuite/templates/multimodels.ftl | 84 ---- .../core/templatesuite/templates/nested.f3ac | 29 ++ .../core/templatesuite/templates/nested.ftl | 29 -- .../templatesuite/templates/nestedinclude.f3ac | 21 + .../templatesuite/templates/nestedinclude.ftl | 21 - .../templates/new-defaultresolver.f3ac | 23 ++ .../templates/new-defaultresolver.ftl | 23 -- .../core/templatesuite/templates/new-optin.f3ac | 30 ++ .../core/templatesuite/templates/new-optin.ftl | 30 -- .../core/templatesuite/templates/noparse.f3ac | 62 +++ .../core/templatesuite/templates/noparse.ftl | 62 --- .../templatesuite/templates/number-format.f3ac | 42 ++ .../templatesuite/templates/number-format.ftl | 42 -- .../templatesuite/templates/number-literal.f3ac | 133 ++++++ .../templatesuite/templates/number-literal.ftl | 133 ------ .../templates/number-math-builtins.f3ac | 78 ++++ .../templates/number-math-builtins.ftl | 78 ---- .../templatesuite/templates/number-to-date.f3ac | 35 ++ .../templatesuite/templates/number-to-date.ftl | 35 -- .../templatesuite/templates/numerical-cast.f3ac | 82 ++++ .../templatesuite/templates/numerical-cast.ftl | 82 ---- .../templates/output-encoding1.f3ac | 30 ++ .../templates/output-encoding1.ftl | 30 -- .../templates/output-encoding2.f3ac | 28 ++ .../templates/output-encoding2.ftl | 28 -- .../templates/output-encoding3.f3ac | 28 ++ .../templates/output-encoding3.ftl | 28 -- .../templates/overloaded-methods.f3ac | 411 +++++++++++++++++++ .../templates/overloaded-methods.ftl | 411 ------------------- .../templatesuite/templates/precedence.f3ac | 61 +++ .../core/templatesuite/templates/precedence.ftl | 61 --- .../core/templatesuite/templates/range.f3ac | 350 ++++++++++++++++ .../core/templatesuite/templates/range.ftl | 350 ---------------- .../core/templatesuite/templates/recover.f3ac | 47 +++ .../core/templatesuite/templates/recover.ftl | 47 --- .../core/templatesuite/templates/root.f3ac | 47 +++ .../core/templatesuite/templates/root.ftl | 47 --- .../templates/sequence-builtins.f3ac | 360 ++++++++++++++++ .../templates/sequence-builtins.ftl | 360 ---------------- .../core/templatesuite/templates/setting.f3ac | 53 +++ .../core/templatesuite/templates/setting.ftl | 53 --- .../templates/simplehash-char-key.f3ac | 44 ++ .../templates/simplehash-char-key.ftl | 44 -- .../templatesuite/templates/specialvars.f3ac | 38 ++ .../templatesuite/templates/specialvars.ftl | 38 -- .../templates/string-builtin-coercion.f3ac | 34 ++ .../templates/string-builtin-coercion.ftl | 34 -- .../string-builtins-regexps-matches.f3ac | 118 ++++++ .../string-builtins-regexps-matches.ftl | 118 ------ .../templates/string-builtins-regexps.f3ac | 136 ++++++ .../templates/string-builtins-regexps.ftl | 136 ------ .../templates/string-builtins1.f3ac | 129 ++++++ .../templates/string-builtins1.ftl | 129 ------ .../templates/string-builtins2.f3ac | 135 ++++++ .../templates/string-builtins2.ftl | 135 ------ .../templates/string-builtins3.f3ac | 225 ++++++++++ .../templates/string-builtins3.ftl | 225 ---------- .../templates/stringbimethods.f3ac | 32 ++ .../templatesuite/templates/stringbimethods.ftl | 32 -- .../templatesuite/templates/stringliteral.f3ac | 69 ++++ .../templatesuite/templates/stringliteral.ftl | 69 ---- .../templates/subdir/include-subdir.f3ac | 27 ++ .../templates/subdir/include-subdir.ftl | 27 -- .../templates/subdir/include-subdir2.f3ac | 19 + .../templates/subdir/include-subdir2.ftl | 19 - .../templates/subdir/new-optin-2.f3ac | 24 ++ .../templates/subdir/new-optin-2.ftl | 24 -- .../templates/subdir/new-optin.f3ac | 26 ++ .../templates/subdir/new-optin.ftl | 26 -- .../templates/subdir/subsub/new-optin.f3ac | 24 ++ .../templates/subdir/subsub/new-optin.ftl | 24 -- .../templatesuite/templates/switch-builtin.f3ac | 54 +++ .../templatesuite/templates/switch-builtin.ftl | 54 --- .../core/templatesuite/templates/switch.f3ac | 138 +++++++ .../core/templatesuite/templates/switch.ftl | 138 ------- .../templatesuite/templates/then-builtin.f3ac | 53 +++ .../templatesuite/templates/then-builtin.ftl | 53 --- .../templatesuite/templates/type-builtins.f3ac | 40 ++ .../templatesuite/templates/type-builtins.ftl | 40 -- .../core/templatesuite/templates/undefined.f3ac | 19 + .../core/templatesuite/templates/undefined.ftl | 19 - .../core/templatesuite/templates/url.f3ac | 24 ++ .../core/templatesuite/templates/url.ftl | 24 -- .../templatesuite/templates/var-layers.f3ac | 39 ++ .../core/templatesuite/templates/var-layers.ftl | 39 -- .../core/templatesuite/templates/varargs.f3ac | 45 ++ .../core/templatesuite/templates/varargs.ftl | 45 -- .../core/templatesuite/templates/variables.f3ac | 70 ++++ .../core/templatesuite/templates/variables.ftl | 70 ---- .../templatesuite/templates/varlayers_lib.f3ac | 28 ++ .../templatesuite/templates/varlayers_lib.ftl | 28 -- .../templates/whitespace-trim.f3ac | 102 +++++ .../templatesuite/templates/whitespace-trim.ftl | 102 ----- .../templates/wsstripinheader_inc.f3ac | 22 + .../templates/wsstripinheader_inc.ftl | 22 - .../templates/wstrip-in-header.f3ac | 26 ++ .../templates/wstrip-in-header.ftl | 26 -- .../freemarker/core/templatesuite/testcases.xml | 10 +- .../org/apache/freemarker/core/toCache1.f3ah | 19 + .../org/apache/freemarker/core/toCache1.ftl | 19 - .../org/apache/freemarker/core/toCache2.f3ah | 19 + .../org/apache/freemarker/core/toCache2.ftl | 19 - .../templatesuite/templates/default-xmlns.f3ac | 28 ++ .../templatesuite/templates/default-xmlns.ftl | 28 -- .../templatesuite/templates/xml-fragment.f3ac | 26 ++ .../templatesuite/templates/xml-fragment.ftl | 26 -- .../templates/xml-ns_prefix-scope-lib.f3ac | 23 ++ .../templates/xml-ns_prefix-scope-lib.ftl | 23 -- .../templates/xml-ns_prefix-scope-main.f3ac | 36 ++ .../templates/xml-ns_prefix-scope-main.ftl | 36 -- .../dom/templatesuite/templates/xml.f3ac | 47 +++ .../dom/templatesuite/templates/xml.ftl | 47 --- .../dom/templatesuite/templates/xmlns1.f3ac | 53 +++ .../dom/templatesuite/templates/xmlns1.ftl | 53 --- .../dom/templatesuite/templates/xmlns3.f3ac | 70 ++++ .../dom/templatesuite/templates/xmlns3.ftl | 70 ---- .../dom/templatesuite/templates/xmlns4.f3ac | 70 ++++ .../dom/templatesuite/templates/xmlns4.ftl | 70 ---- .../dom/templatesuite/templates/xmlns5.f3ac | 28 ++ .../dom/templatesuite/templates/xmlns5.ftl | 28 -- .../freemarker/dom/templatesuite/testcases.xml | 6 +- .../servlet/WebAppTemplateLoaderTest.java | 2 +- .../servlet/jsp/RealServletContainertTest.java | 84 ++-- .../freemarker/servlet/test/WebAppTestCase.java | 2 +- .../servlet/jsp/templates/classpath-test.f3ah | 19 + .../servlet/jsp/templates/classpath-test.ftl | 19 - .../servlet/jsp/webapps/basic/CONTENTS.txt | 12 +- .../servlet/jsp/webapps/basic/WEB-INF/web.xml | 4 +- .../servlet/jsp/webapps/basic/attributes.f3ah | 90 ++++ .../servlet/jsp/webapps/basic/attributes.ftl | 90 ---- .../jsp/webapps/basic/customELFunctions1.f3ah | 30 ++ .../jsp/webapps/basic/customELFunctions1.ftl | 30 -- .../servlet/jsp/webapps/basic/customTags1.f3ah | 59 +++ .../servlet/jsp/webapps/basic/customTags1.ftl | 59 --- .../webapps/basic/elFunctionsTagNameClash.f3ah | 25 ++ .../webapps/basic/elFunctionsTagNameClash.ftl | 25 -- .../jsp/webapps/basic/trivial-jstl-@Ignore.f3ah | 48 +++ .../jsp/webapps/basic/trivial-js...@ignore.ftl | 48 --- .../servlet/jsp/webapps/basic/trivial.f3ah | 37 ++ .../servlet/jsp/webapps/basic/trivial.ftl | 37 -- .../servlet/jsp/webapps/config/CONTENTS.txt | 10 +- .../config/WEB-INF/classes/sub/test.f3ah | 19 + .../webapps/config/WEB-INF/classes/sub/test.ftl | 19 - .../webapps/config/WEB-INF/classes/test.f3ah | 19 + .../jsp/webapps/config/WEB-INF/classes/test.ftl | 19 - .../WEB-INF/lib/templates.jar/sub/test2.f3ah | 19 + .../WEB-INF/lib/templates.jar/sub/test2.ftl | 19 - .../webapps/config/WEB-INF/templates/test.f3ah | 19 + .../webapps/config/WEB-INF/templates/test.ftl | 19 - .../servlet/jsp/webapps/config/test.f3ah | 19 + .../servlet/jsp/webapps/config/test.ftl | 19 - .../servlet/jsp/webapps/errors/CONTENTS.txt | 6 +- .../jsp/webapps/errors/failing-parsetime.f3ahnv | 20 + .../jsp/webapps/errors/failing-parsetime.ftlnv | 20 - .../jsp/webapps/errors/failing-runtime.f3ah | 26 ++ .../jsp/webapps/errors/failing-runtime.ftl | 26 -- .../servlet/jsp/webapps/errors/not-failing.f3ah | 19 + .../servlet/jsp/webapps/errors/not-failing.ftl | 19 - .../jsp/webapps/multipleLoaders/CONTENTS.txt | 2 +- .../multipleLoaders/WEB-INF/templates/test.f3ah | 19 + .../multipleLoaders/WEB-INF/templates/test.ftl | 19 - .../jsp/webapps/multipleLoaders/WEB-INF/web.xml | 4 +- .../jsp/webapps/tldDiscovery/CONTENTS.txt | 6 +- .../jsp/webapps/tldDiscovery/WEB-INF/web.xml | 4 +- .../webapps/tldDiscovery/subdir/test-rel.f3ah | 20 + .../webapps/tldDiscovery/subdir/test-rel.ftl | 20 - .../webapps/tldDiscovery/test-noClasspath.f3ah | 32 ++ .../webapps/tldDiscovery/test-noClasspath.ftl | 32 -- .../servlet/jsp/webapps/tldDiscovery/test1.f3ah | 55 +++ .../servlet/jsp/webapps/tldDiscovery/test1.ftl | 55 --- .../WEB-INF/templates/test.f3ah | 19 + .../WEB-INF/templates/test.ftl | 19 - .../SpringResourceTemplateLoaderTest.java | 2 +- .../META-INF/templates/sub1/sub2/t.f3ah | 19 + .../META-INF/templates/sub1/sub2/t.ftl | 19 - .../freemarker/test/TemplateTestSuite.java | 4 +- 333 files changed, 9018 insertions(+), 9037 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/java/org/apache/freemarker/core/ASTTest.java ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ASTTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ASTTest.java index 217b7ff..b5509d5 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ASTTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ASTTest.java @@ -24,8 +24,8 @@ import java.io.IOException; import org.apache.freemarker.core.ASTPrinter.Options; import org.apache.freemarker.core.util._StringUtils; -import org.apache.freemarker.test.TestUtils; import org.apache.freemarker.test.FileTestCase; +import org.apache.freemarker.test.TestUtils; public class ASTTest extends FileTestCase { @@ -84,7 +84,7 @@ public class ASTTest extends FileTestCase { } private void testAST(String testName, Options ops) throws FileNotFoundException, IOException { - final String templateName = testName + ".ftl"; + final String templateName = testName + ".f3ah"; assertExpectedFileEqualsString( testName + ".ast", ASTPrinter.getASTAsString(templateName, http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/java/org/apache/freemarker/core/CanonicalFormTest.java ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CanonicalFormTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CanonicalFormTest.java index 1bf4888..f437081 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CanonicalFormTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CanonicalFormTest.java @@ -24,8 +24,8 @@ import java.io.StringWriter; import org.apache.freemarker.core.templateresolver.impl.ClassTemplateLoader; import org.apache.freemarker.test.CopyrightCommentRemoverTemplateLoader; -import org.apache.freemarker.test.TestConfigurationBuilder; import org.apache.freemarker.test.FileTestCase; +import org.apache.freemarker.test.TestConfigurationBuilder; public class CanonicalFormTest extends FileTestCase { @@ -34,23 +34,23 @@ public class CanonicalFormTest extends FileTestCase { } public void testCallableDefinitionCanonicalForm() throws Exception { - assertCanonicalFormOf("cano-macro-and-function.ftl"); + assertCanonicalFormOf("cano-macro-and-function.f3ah"); } public void testIdentifierEscapingCanonicalForm() throws Exception { - assertCanonicalFormOf("cano-identifier-escaping.ftl"); + assertCanonicalFormOf("cano-identifier-escaping.f3au"); } public void testAssignmentCanonicalForm() throws Exception { - assertCanonicalFormOf("cano-assignments.ftl"); + assertCanonicalFormOf("cano-assignments.f3ah"); } public void testBuiltInCanonicalForm() throws Exception { - assertCanonicalFormOf("cano-builtins.ftl"); + assertCanonicalFormOf("cano-builtins.f3ah"); } public void testStringLiteralInterpolationCanonicalForm() throws Exception { - assertCanonicalFormOf("cano-strlitinterpolation.ftl"); + assertCanonicalFormOf("cano-strlitinterpolation.f3ah"); } private void assertCanonicalFormOf(String ftlFileName) http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java index e5bb433..b486f8b 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java @@ -208,7 +208,7 @@ public class ConfigurationTest { .templateLoader(new ClassTemplateLoader(getClass(), "nosuchpackage")) .build(); try { - cfg.getTemplate("missing.ftl"); + cfg.getTemplate("missing.f3ah"); fail(); } catch (TemplateNotFoundException e) { assertThat(e.getMessage(), not(containsString("wasn't set"))); @@ -256,10 +256,10 @@ public class ConfigurationTest { @SuppressWarnings("boxing") public void testGetTemplateOverloads() throws Exception { final Locale hu = new Locale("hu", "HU"); - final String tFtl = "t.ftl"; - final String tHuFtl = "t_hu.ftl"; - final String tEnFtl = "t_en.ftl"; - final String tUtf8Ftl = "utf8.ftl"; + final String tFtl = "t.f3ah"; + final String tHuFtl = "t_hu.f3ah"; + final String tEnFtl = "t_en.f3ah"; + final String tUtf8Ftl = "utf8.f3ah"; final Serializable custLookupCond = 12345; ByteArrayTemplateLoader tl = new ByteArrayTemplateLoader(); @@ -348,12 +348,12 @@ public class ConfigurationTest { // 4 args: try { - cfg.getTemplate("missing.ftl", hu, custLookupCond, false); + cfg.getTemplate("missing.f3ah", hu, custLookupCond, false); fail(); } catch (TemplateNotFoundException e) { // Expected } - assertNull(cfg.getTemplate("missing.ftl", hu, custLookupCond, true)); + assertNull(cfg.getTemplate("missing.f3ah", hu, custLookupCond, true)); { Template t = cfg.getTemplate(tFtl, hu, custLookupCond, false); assertEquals(tFtl, t.getLookupName()); @@ -393,13 +393,13 @@ public class ConfigurationTest { cfgB.setTemplateLoader(new ClassTemplateLoader(ConfigurationTest.class, "")); Configuration cfg = cfgB.build(); assertEquals(0, cache.getSize()); - cfg.getTemplate("toCache1.ftl"); + cfg.getTemplate("toCache1.f3ah"); assertEquals(1, cache.getSize()); - cfg.getTemplate("toCache2.ftl"); + cfg.getTemplate("toCache2.f3ah"); assertEquals(2, cache.getSize()); cfg.clearTemplateCache(); assertEquals(0, cache.getSize()); - cfg.getTemplate("toCache1.ftl"); + cfg.getTemplate("toCache1.f3ah"); assertEquals(1, cache.getSize()); cfgB.setTemplateLoader(cfgB.getTemplateLoader()); assertEquals(1, cache.getSize()); @@ -408,18 +408,18 @@ public class ConfigurationTest { @Test public void testTemplateNameFormat() throws Exception { StringTemplateLoader tl = new StringTemplateLoader(); - tl.putTemplate("a/b.ftl", "In a/b.ftl"); - tl.putTemplate("b.ftl", "In b.ftl"); + tl.putTemplate("a/b.f3ah", "In a/b.f3ah"); + tl.putTemplate("b.f3ah", "In b.f3ah"); { Configuration cfg = new Builder(VERSION_3_0_0) .templateLoader(tl) .templateNameFormat(DefaultTemplateNameFormat.INSTANCE) .build(); - final Template template = cfg.getTemplate("a/./../b.ftl"); - assertEquals("b.ftl", template.getLookupName()); - assertEquals("b.ftl", template.getSourceName()); - assertEquals("In b.ftl", template.toString()); + final Template template = cfg.getTemplate("a/./../b.f3ah"); + assertEquals("b.f3ah", template.getLookupName()); + assertEquals("b.f3ah", template.getSourceName()); + assertEquals("In b.f3ah", template.toString()); } } @@ -455,7 +455,7 @@ public class ConfigurationTest { .templateLoader(new ClassTemplateLoader(ConfigurationTest.class, "")) .build(); assertSame(DefaultTemplateLookupStrategy.INSTANCE, cfg.getTemplateLookupStrategy()); - assertEquals("toCache1.ftl", cfg.getTemplate("toCache1.ftl").getSourceName()); + assertEquals("toCache1.f3ah", cfg.getTemplate("toCache1.f3ah").getSourceName()); } @Test @@ -463,7 +463,7 @@ public class ConfigurationTest { final TemplateLookupStrategy myStrategy = new TemplateLookupStrategy() { @Override public TemplateLookupResult lookup(TemplateLookupContext ctx) throws IOException { - return ctx.lookupWithAcquisitionStrategy("toCache2.ftl"); + return ctx.lookupWithAcquisitionStrategy("toCache2.f3ah"); } }; @@ -472,7 +472,7 @@ public class ConfigurationTest { .templateLookupStrategy(myStrategy) .build(); assertSame(myStrategy, cfg.getTemplateLookupStrategy()); - assertEquals("toCache2.ftl", cfg.getTemplate("toCache1.ftl").getSourceName()); + assertEquals("toCache2.f3ah", cfg.getTemplate("toCache1.f3ah").getSourceName()); } @Test @@ -481,10 +481,10 @@ public class ConfigurationTest { assertNull(cfgB.getTemplateConfigurations()); StringTemplateLoader tl = new StringTemplateLoader(); - tl.putTemplate("t.de.ftlh", ""); - tl.putTemplate("t.fr.ftlx", ""); - tl.putTemplate("t.ftlx", ""); - tl.putTemplate("Stat/t.de.ftlx", ""); + tl.putTemplate("t.de.f3ah", ""); + tl.putTemplate("t.fr.f3ax", ""); + tl.putTemplate("t.f3ax", ""); + tl.putTemplate("Stat/t.de.f3ax", ""); cfgB.setTemplateLoader(tl); cfgB.setTimeZone(TimeZone.getTimeZone("GMT+09")); @@ -500,9 +500,9 @@ public class ConfigurationTest { + "), " + "FirstMatchTemplateConfigurationFactory(" + "ConditionalTemplateConfigurationFactory(" - + "FileExtensionMatcher('ftlh'), TemplateConfiguration(booleanFormat='TODO,HTML')), " + + "FileExtensionMatcher('f3ah'), TemplateConfiguration(booleanFormat='TODO,HTML')), " + "ConditionalTemplateConfigurationFactory(" - + "FileExtensionMatcher('ftlx'), TemplateConfiguration(booleanFormat='TODO,XML')), " + + "FileExtensionMatcher('f3ax'), TemplateConfiguration(booleanFormat='TODO,XML')), " + "noMatchErrorDetails='Unrecognized template file extension'" + "), " + "ConditionalTemplateConfigurationFactory(" @@ -513,22 +513,22 @@ public class ConfigurationTest { Configuration cfg = cfgB.build(); { - Template t = cfg.getTemplate("t.de.ftlh"); + Template t = cfg.getTemplate("t.de.f3ah"); assertEquals("TODO,HTML", t.getBooleanFormat()); assertEquals(TimeZone.getTimeZone("GMT+01"), t.getTimeZone()); } { - Template t = cfg.getTemplate("t.fr.ftlx"); + Template t = cfg.getTemplate("t.fr.f3ax"); assertEquals("TODO,XML", t.getBooleanFormat()); assertEquals(TimeZone.getTimeZone("GMT"), t.getTimeZone()); } { - Template t = cfg.getTemplate("t.ftlx"); + Template t = cfg.getTemplate("t.f3ax"); assertEquals("TODO,XML", t.getBooleanFormat()); assertEquals(TimeZone.getTimeZone("GMT+09"), t.getTimeZone()); } { - Template t = cfg.getTemplate("Stat/t.de.ftlx"); + Template t = cfg.getTemplate("Stat/t.de.f3ax"); assertEquals("TODO,XML", t.getBooleanFormat()); assertEquals(_DateUtils.UTC, t.getTimeZone()); } @@ -868,8 +868,8 @@ public class ConfigurationTest { assertEquals("Y,N", cfg.getTemplateConfigurations().get("t.yn", null).getBooleanFormat()); assertNotNull(cfg.getCustomNumberFormat("hex")); assertNotNull(cfg.getCustomDateFormat("epoch")); - assertEquals(ImmutableMap.of("lib", "lib.ftl"), cfg.getAutoImports()); - assertEquals(ImmutableList.of("inc.ftl"), cfg.getAutoIncludes()); + assertEquals(ImmutableMap.of("lib", "lib.f3ah"), cfg.getAutoImports()); + assertEquals(ImmutableList.of("inc.f3ah"), cfg.getAutoIncludes()); assertEquals(ImmutableMap.of("v", 1), cfg.getSharedVariables()); assertEquals(ImmutableList.of(CustomHTMLOutputFormat.INSTANCE, DummyOutputFormat.INSTANCE), cfg.getRegisteredCustomOutputFormats()); @@ -890,8 +890,8 @@ public class ConfigurationTest { ) .customNumberFormats(ImmutableMap.of("baseN", BaseNTemplateNumberFormatFactory.INSTANCE)) .customDateFormats(ImmutableMap.of("epochDiv", EpochMillisDivTemplateDateFormatFactory.INSTANCE)) - .autoImports(ImmutableMap.of("lib2", "lib2.ftl")) - .autoIncludes(ImmutableList.of("inc2.ftl")) + .autoImports(ImmutableMap.of("lib2", "lib2.f3ah")) + .autoIncludes(ImmutableList.of("inc2.f3ah")) .sharedVariables(ImmutableMap.of("v2", 2)) .registeredCustomOutputFormats( SeldomEscapedOutputFormat.INSTANCE, NameClashingDummyOutputFormat.INSTANCE) @@ -907,9 +907,9 @@ public class ConfigurationTest { assertNotNull(cfg.getCustomDateFormat("epoch")); assertNotNull(cfg.getCustomDateFormat("epochDiv")); - assertEquals(ImmutableMap.of("lib", "lib.ftl", "lib2", "lib2.ftl"), cfg.getAutoImports()); + assertEquals(ImmutableMap.of("lib", "lib.f3ah", "lib2", "lib2.f3ah"), cfg.getAutoImports()); - assertEquals(ImmutableList.of("inc.ftl", "inc2.ftl"), cfg.getAutoIncludes()); + assertEquals(ImmutableList.of("inc.f3ah", "inc2.f3ah"), cfg.getAutoIncludes()); assertEquals(ImmutableMap.of("v", 1, "v2", 2), cfg.getSharedVariables()); @@ -972,12 +972,12 @@ public class ConfigurationTest { @Override protected Map<String, String> getImpliedAutoImports() { - return ImmutableMap.of("lib", "lib.ftl"); + return ImmutableMap.of("lib", "lib.f3ah"); } @Override protected List<String> getImpliedAutoIncludes() { - return ImmutableList.of("inc.ftl"); + return ImmutableList.of("inc.f3ah"); } @Override http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/java/org/apache/freemarker/core/EncodingOverrideTest.java ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/EncodingOverrideTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/EncodingOverrideTest.java index b1acead..e9b64f2 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/EncodingOverrideTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/EncodingOverrideTest.java @@ -34,14 +34,14 @@ public class EncodingOverrideTest { @Test public void testMarchingCharset() throws Exception { - Template t = createConfig(StandardCharsets.UTF_8).getTemplate("encodingOverride-UTF-8.ftl"); + Template t = createConfig(StandardCharsets.UTF_8).getTemplate("encodingOverride-UTF-8.f3ah"); assertEquals(StandardCharsets.UTF_8, t.getActualSourceEncoding()); checkTemplateOutput(t); } @Test public void testDifferentCharset() throws Exception { - Template t = createConfig(StandardCharsets.UTF_8).getTemplate("encodingOverride-ISO-8859-1.ftl"); + Template t = createConfig(StandardCharsets.UTF_8).getTemplate("encodingOverride-ISO-8859-1.f3ah"); assertEquals(StandardCharsets.ISO_8859_1, t.getActualSourceEncoding()); checkTemplateOutput(t); } http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateLookupStrategyTest.java ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateLookupStrategyTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateLookupStrategyTest.java index 2d385e2..66d37e2 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateLookupStrategyTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateLookupStrategyTest.java @@ -19,7 +19,7 @@ package org.apache.freemarker.core; -import static org.apache.freemarker.core.Configuration.ExtendableBuilder.TEMPLATE_LOOKUP_STRATEGY_KEY; +import static org.apache.freemarker.core.Configuration.ExtendableBuilder.*; import static org.junit.Assert.*; import java.io.IOException; @@ -62,8 +62,8 @@ public class TemplateLookupStrategyTest { @Test public void testCustomStrategy() throws IOException { MonitoredTemplateLoader tl = new MonitoredTemplateLoader(); - tl.putTextTemplate("test.ftl", ""); - tl.putTextTemplate("aa/test.ftl", ""); + tl.putTextTemplate("test.f3ah", ""); + tl.putTextTemplate("aa/test.f3ah", ""); Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0) .templateLoader(tl) @@ -73,22 +73,22 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("aa", "BB", "CC_DD"); try { - cfg.getTemplate("missing.ftl", locale); + cfg.getTemplate("missing.f3ah", locale); fail(); } catch (TemplateNotFoundException e) { - assertEquals("missing.ftl", e.getTemplateName()); - assertEquals(ImmutableList.of("aa/missing.ftl", "missing.ftl"), tl.getLoadNames()); + assertEquals("missing.f3ah", e.getTemplateName()); + assertEquals(ImmutableList.of("aa/missing.f3ah", "missing.f3ah"), tl.getLoadNames()); tl.clearEvents(); cfg.clearTemplateCache(); } { - final Template t = cfg.getTemplate("test.ftl", locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("aa/test.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("test.f3ah", locale); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("aa/test.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); - assertEquals(ImmutableList.of("aa/test.ftl"), tl.getLoadNames()); + assertEquals(ImmutableList.of("aa/test.f3ah"), tl.getLoadNames()); tl.clearEvents(); cfg.clearTemplateCache(); } @@ -97,25 +97,25 @@ public class TemplateLookupStrategyTest { @Test public void testDefaultStrategy() throws IOException { MonitoredTemplateLoader tl = new MonitoredTemplateLoader(); - tl.putTextTemplate("test.ftl", ""); - tl.putTextTemplate("test_aa.ftl", ""); - tl.putTextTemplate("test_aa_BB.ftl", ""); - tl.putTextTemplate("test_aa_BB_CC.ftl", ""); - tl.putTextTemplate("test_aa_BB_CC_DD.ftl", ""); + tl.putTextTemplate("test.f3ah", ""); + tl.putTextTemplate("test_aa.f3ah", ""); + tl.putTextTemplate("test_aa_BB.f3ah", ""); + tl.putTextTemplate("test_aa_BB_CC.f3ah", ""); + tl.putTextTemplate("test_aa_BB_CC_DD.f3ah", ""); try { new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() - .getTemplate("missing.ftl", new Locale("aa", "BB", "CC_DD")); + .getTemplate("missing.f3ah", new Locale("aa", "BB", "CC_DD")); fail(); } catch (TemplateNotFoundException e) { - assertEquals("missing.ftl", e.getTemplateName()); + assertEquals("missing.f3ah", e.getTemplateName()); assertEquals( ImmutableList.of( - "missing_aa_BB_CC_DD.ftl", - "missing_aa_BB_CC.ftl", - "missing_aa_BB.ftl", - "missing_aa.ftl", - "missing.ftl"), + "missing_aa_BB_CC_DD.f3ah", + "missing_aa_BB_CC.f3ah", + "missing_aa_BB.f3ah", + "missing_aa.f3ah", + "missing.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -123,12 +123,12 @@ public class TemplateLookupStrategyTest { try { new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl) .locale(new Locale("xx")).build() - .getTemplate("missing.ftl"); + .getTemplate("missing.f3ah"); fail(); } catch (TemplateNotFoundException e) { - assertEquals("missing.ftl", e.getTemplateName()); + assertEquals("missing.f3ah", e.getTemplateName()); assertEquals( - ImmutableList.of("missing_xx.ftl", "missing.ftl"), + ImmutableList.of("missing_xx.f3ah", "missing.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -137,38 +137,38 @@ public class TemplateLookupStrategyTest { new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl) .locale(new Locale("xx")) .localizedTemplateLookup(false).build() - .getTemplate("missing.ftl"); + .getTemplate("missing.f3ah"); fail(); } catch (TemplateNotFoundException e) { - assertEquals("missing.ftl", e.getTemplateName()); + assertEquals("missing.f3ah", e.getTemplateName()); assertEquals( - ImmutableList.of("missing.ftl"), + ImmutableList.of("missing.f3ah"), tl.getLoadNames()); tl.clearEvents(); } try { new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() - .getTemplate("_a_b_.ftl", new Locale("xx", "yy")); + .getTemplate("_a_b_.f3ah", new Locale("xx", "yy")); fail(); } catch (TemplateNotFoundException e) { - assertEquals("_a_b_.ftl", e.getTemplateName()); + assertEquals("_a_b_.f3ah", e.getTemplateName()); assertEquals( - ImmutableList.of("_a_b__xx_YY.ftl", "_a_b__xx.ftl", "_a_b_.ftl"), + ImmutableList.of("_a_b__xx_YY.f3ah", "_a_b__xx.f3ah", "_a_b_.f3ah"), tl.getLoadNames()); tl.clearEvents(); } - for (String templateName : new String[] { "test.ftl", "./test.ftl", "/test.ftl", "x/foo/../../test.ftl" }) { + for (String templateName : new String[] { "test.f3ah", "./test.f3ah", "/test.f3ah", "x/foo/../../test.f3ah" }) { { final Locale locale = new Locale("aa", "BB", "CC_DD"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() - .getTemplate("test.ftl", locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test_aa_BB_CC_DD.ftl", t.getSourceName()); + .getTemplate("test.f3ah", locale); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test_aa_BB_CC_DD.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); - assertEquals(ImmutableList.of("test_aa_BB_CC_DD.ftl"), tl.getLoadNames()); + assertEquals(ImmutableList.of("test_aa_BB_CC_DD.f3ah"), tl.getLoadNames()); assertNull(t.getCustomLookupCondition()); tl.clearEvents(); } @@ -177,11 +177,11 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("aa", "BB", "CC_XX"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test_aa_BB_CC.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test_aa_BB_CC.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); - assertEquals(ImmutableList.of("test_aa_BB_CC_XX.ftl", "test_aa_BB_CC.ftl"), tl.getLoadNames()); + assertEquals(ImmutableList.of("test_aa_BB_CC_XX.f3ah", "test_aa_BB_CC.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -189,12 +189,12 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("aa", "BB", "XX_XX"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test_aa_BB.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test_aa_BB.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( - ImmutableList.of("test_aa_BB_XX_XX.ftl", "test_aa_BB_XX.ftl", "test_aa_BB.ftl"), + ImmutableList.of("test_aa_BB_XX_XX.f3ah", "test_aa_BB_XX.f3ah", "test_aa_BB.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -204,12 +204,12 @@ public class TemplateLookupStrategyTest { final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl) .localizedTemplateLookup(false).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( - ImmutableList.of("test.ftl"), + ImmutableList.of("test.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -218,12 +218,12 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("aa", "XX", "XX_XX"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test_aa.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test_aa.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( - ImmutableList.of("test_aa_XX_XX_XX.ftl", "test_aa_XX_XX.ftl", "test_aa_XX.ftl", "test_aa.ftl"), + ImmutableList.of("test_aa_XX_XX_XX.f3ah", "test_aa_XX_XX.f3ah", "test_aa_XX.f3ah", "test_aa.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -232,13 +232,13 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("xx", "XX", "XX_XX"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( ImmutableList.of( - "test_xx_XX_XX_XX.ftl", "test_xx_XX_XX.ftl", "test_xx_XX.ftl", "test_xx.ftl", "test.ftl"), + "test_xx_XX_XX_XX.f3ah", "test_xx_XX_XX.f3ah", "test_xx_XX.f3ah", "test_xx.f3ah", "test.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -247,13 +247,13 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("xx", "BB", "CC_DD"); final Template t = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build() .getTemplate(templateName, locale); - assertEquals("test.ftl", t.getLookupName()); - assertEquals("test.ftl", t.getSourceName()); + assertEquals("test.f3ah", t.getLookupName()); + assertEquals("test.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( ImmutableList.of( - "test_xx_BB_CC_DD.ftl", "test_xx_BB_CC.ftl", "test_xx_BB.ftl", "test_xx.ftl", "test.ftl"), + "test_xx_BB_CC_DD.f3ah", "test_xx_BB_CC.f3ah", "test_xx_BB.f3ah", "test_xx.f3ah", "test.f3ah"), tl.getLoadNames()); tl.clearEvents(); } @@ -263,39 +263,39 @@ public class TemplateLookupStrategyTest { @Test public void testAcquisition() throws IOException { MonitoredTemplateLoader tl = new MonitoredTemplateLoader(); - tl.putTextTemplate("t.ftl", ""); - tl.putTextTemplate("sub/i.ftl", ""); - tl.putTextTemplate("x/sub/i.ftl", ""); + tl.putTextTemplate("t.f3ah", ""); + tl.putTextTemplate("sub/i.f3ah", ""); + tl.putTextTemplate("x/sub/i.f3ah", ""); Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build(); final Locale locale = new Locale("xx"); { - final Template t = cfg.getTemplate("/./moo/../x/y/*/sub/i.ftl", locale); - assertEquals("x/y/*/sub/i.ftl", t.getLookupName()); - assertEquals("x/sub/i.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("/./moo/../x/y/*/sub/i.f3ah", locale); + assertEquals("x/y/*/sub/i.f3ah", t.getLookupName()); + assertEquals("x/sub/i.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( ImmutableList.of( - "x/y/sub/i_xx.ftl", "x/sub/i_xx.ftl", "sub/i_xx.ftl", - "x/y/sub/i.ftl", "x/sub/i.ftl"), + "x/y/sub/i_xx.f3ah", "x/sub/i_xx.f3ah", "sub/i_xx.f3ah", + "x/y/sub/i.f3ah", "x/sub/i.f3ah"), tl.getLoadNames()); tl.clearEvents(); cfg.clearTemplateCache(); } { - final Template t = cfg.getTemplate("a/b/*/./sub/i.ftl", locale); - assertEquals("a/b/*/sub/i.ftl", t.getLookupName()); - assertEquals("sub/i.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("a/b/*/./sub/i.f3ah", locale); + assertEquals("a/b/*/sub/i.f3ah", t.getLookupName()); + assertEquals("sub/i.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertNull(t.getCustomLookupCondition()); assertEquals( ImmutableList.of( - "a/b/sub/i_xx.ftl", "a/sub/i_xx.ftl", "sub/i_xx.ftl", - "a/b/sub/i.ftl", "a/sub/i.ftl", "sub/i.ftl"), + "a/b/sub/i_xx.f3ah", "a/sub/i_xx.f3ah", "sub/i_xx.f3ah", + "a/b/sub/i.f3ah", "a/sub/i.f3ah", "sub/i.f3ah"), tl.getLoadNames()); tl.clearEvents(); cfg.clearTemplateCache(); @@ -325,43 +325,43 @@ public class TemplateLookupStrategyTest { final String iAtBaazComContent = "i at baaz.com"; final String iAtFooComContent = "i at foo.com"; final String tAtDefaultWithoutIncludeContent = "t at default "; - final String tAtDefaultContent = toCanonicalFTL(tAtDefaultWithoutIncludeContent + "<#include 'i.ftl'>", cfg); + final String tAtDefaultContent = toCanonicalFTL(tAtDefaultWithoutIncludeContent + "<#include 'i.f3ah'>", cfg); final String tAtBarComWithoutIncludeContent = "t at bar.com "; - final String tAtBarComContent = toCanonicalFTL(tAtBarComWithoutIncludeContent + "<#include 'i.ftl'>", cfg); + final String tAtBarComContent = toCanonicalFTL(tAtBarComWithoutIncludeContent + "<#include 'i.f3ah'>", cfg); final String tAtFooComWithoutIncludeContent = "t at foo.com "; - final String tAtFooComContent = toCanonicalFTL(tAtFooComWithoutIncludeContent + "<#include 'i.ftl'>", cfg); + final String tAtFooComContent = toCanonicalFTL(tAtFooComWithoutIncludeContent + "<#include 'i.f3ah'>", cfg); final String t2XxLocaleExpectedOutput = "i3_xx at foo.com"; final String t2OtherLocaleExpectedOutput = "i3 at foo.com"; - tl.putTextTemplate("@foo.com/t.ftl", tAtFooComContent); - tl.putTextTemplate("@bar.com/t.ftl", tAtBarComContent); - tl.putTextTemplate("@default/t.ftl", tAtDefaultContent); - tl.putTextTemplate("@foo.com/i.ftl", iAtFooComContent); - tl.putTextTemplate("@baaz.com/i.ftl", iAtBaazComContent); - tl.putTextTemplate("@default/i_xx.ftl", iXxAtDefaultContent); - tl.putTextTemplate("@default/i.ftl", iAtDefaultContent); - tl.putTextTemplate("@foo.com/t2.ftl", "<#import 'i2.ftl' as i2 />${proof}"); - tl.putTextTemplate("@default/i2.ftl", "<#import 'i3.ftl' as i3 />"); - tl.putTextTemplate("@foo.com/i3.ftl", "<#global proof = '" + t2OtherLocaleExpectedOutput + "'>"); - tl.putTextTemplate("@foo.com/i3_xx.ftl", "<#global proof = '" + t2XxLocaleExpectedOutput + "'>"); + tl.putTextTemplate("@foo.com/t.f3ah", tAtFooComContent); + tl.putTextTemplate("@bar.com/t.f3ah", tAtBarComContent); + tl.putTextTemplate("@default/t.f3ah", tAtDefaultContent); + tl.putTextTemplate("@foo.com/i.f3ah", iAtFooComContent); + tl.putTextTemplate("@baaz.com/i.f3ah", iAtBaazComContent); + tl.putTextTemplate("@default/i_xx.f3ah", iXxAtDefaultContent); + tl.putTextTemplate("@default/i.f3ah", iAtDefaultContent); + tl.putTextTemplate("@foo.com/t2.f3ah", "<#import 'i2.f3ah' as i2 />${proof}"); + tl.putTextTemplate("@default/i2.f3ah", "<#import 'i3.f3ah' as i3 />"); + tl.putTextTemplate("@foo.com/i3.f3ah", "<#global proof = '" + t2OtherLocaleExpectedOutput + "'>"); + tl.putTextTemplate("@foo.com/i3_xx.f3ah", "<#global proof = '" + t2XxLocaleExpectedOutput + "'>"); { final Locale locale = new Locale("xx"); final Domain domain = new Domain("foo.com"); - final Template t = cfg.getTemplate("t.ftl", locale, domain); - assertEquals("t.ftl", t.getLookupName()); - assertEquals("@foo.com/t.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("t.f3ah", locale, domain); + assertEquals("t.f3ah", t.getLookupName()); + assertEquals("@foo.com/t.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertEquals(domain, t.getCustomLookupCondition()); assertEquals(tAtFooComContent, t.toString()); assertEquals( - ImmutableList.of("@foo.com/t_xx.ftl", "@foo.com/t.ftl"), + ImmutableList.of("@foo.com/t_xx.f3ah", "@foo.com/t.f3ah"), tl.getLoadNames()); tl.clearEvents(); assertOutputEquals(tAtFooComWithoutIncludeContent + iAtFooComContent, t); assertEquals( - ImmutableList.of("@foo.com/i_xx.ftl", "@foo.com/i.ftl"), + ImmutableList.of("@foo.com/i_xx.f3ah", "@foo.com/i.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -371,22 +371,22 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx"); final Domain domain = new Domain("bar.com"); - final Template t = cfg.getTemplate("t.ftl", locale, domain); - assertEquals("t.ftl", t.getLookupName()); - assertEquals("@bar.com/t.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("t.f3ah", locale, domain); + assertEquals("t.f3ah", t.getLookupName()); + assertEquals("@bar.com/t.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertEquals(domain, t.getCustomLookupCondition()); assertEquals(tAtBarComContent, t.toString()); assertEquals( - ImmutableList.of("@bar.com/t_xx.ftl", "@bar.com/t.ftl"), + ImmutableList.of("@bar.com/t_xx.f3ah", "@bar.com/t.f3ah"), tl.getLoadNames()); tl.clearEvents(); assertOutputEquals(tAtBarComWithoutIncludeContent + iXxAtDefaultContent, t); assertEquals( ImmutableList.of( - "@bar.com/i_xx.ftl", "@bar.com/i.ftl", - "@default/i_xx.ftl"), + "@bar.com/i_xx.f3ah", "@bar.com/i.f3ah", + "@default/i_xx.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -396,22 +396,22 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx", "YY"); final Domain domain = new Domain("baaz.com"); - final Template t = cfg.getTemplate("t.ftl", locale, domain); - assertEquals("t.ftl", t.getLookupName()); - assertEquals("@default/t.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("t.f3ah", locale, domain); + assertEquals("t.f3ah", t.getLookupName()); + assertEquals("@default/t.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertEquals(domain, t.getCustomLookupCondition()); assertEquals(tAtDefaultContent, t.toString()); assertEquals( ImmutableList.of( - "@baaz.com/t_xx_YY.ftl", "@baaz.com/t_xx.ftl", "@baaz.com/t.ftl", - "@default/t_xx_YY.ftl", "@default/t_xx.ftl", "@default/t.ftl"), + "@baaz.com/t_xx_YY.f3ah", "@baaz.com/t_xx.f3ah", "@baaz.com/t.f3ah", + "@default/t_xx_YY.f3ah", "@default/t_xx.f3ah", "@default/t.f3ah"), tl.getLoadNames()); tl.clearEvents(); assertOutputEquals(tAtDefaultWithoutIncludeContent + iAtBaazComContent, t); assertEquals( - ImmutableList.of("@baaz.com/i_xx_YY.ftl", "@baaz.com/i_xx.ftl", "@baaz.com/i.ftl"), + ImmutableList.of("@baaz.com/i_xx_YY.f3ah", "@baaz.com/i_xx.f3ah", "@baaz.com/i.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -421,16 +421,16 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx", "YY"); final Domain domain = new Domain("nosuch.com"); - final Template t = cfg.getTemplate("i.ftl", locale, domain); - assertEquals("i.ftl", t.getLookupName()); - assertEquals("@default/i_xx.ftl", t.getSourceName()); + final Template t = cfg.getTemplate("i.f3ah", locale, domain); + assertEquals("i.f3ah", t.getLookupName()); + assertEquals("@default/i_xx.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertEquals(domain, t.getCustomLookupCondition()); assertEquals(iXxAtDefaultContent, t.toString()); assertEquals( ImmutableList.of( - "@nosuch.com/i_xx_YY.ftl", "@nosuch.com/i_xx.ftl", "@nosuch.com/i.ftl", - "@default/i_xx_YY.ftl", "@default/i_xx.ftl"), + "@nosuch.com/i_xx_YY.f3ah", "@nosuch.com/i_xx.f3ah", "@nosuch.com/i.f3ah", + "@default/i_xx_YY.f3ah", "@default/i_xx.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -440,14 +440,14 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx", "YY"); final Domain domain = new Domain("nosuch.com"); - final Template t = cfgNoLocLU.getTemplate("i.ftl", locale, domain); - assertEquals("i.ftl", t.getLookupName()); - assertEquals("@default/i.ftl", t.getSourceName()); + final Template t = cfgNoLocLU.getTemplate("i.f3ah", locale, domain); + assertEquals("i.f3ah", t.getLookupName()); + assertEquals("@default/i.f3ah", t.getSourceName()); assertEquals(locale, t.getLocale()); assertEquals(domain, t.getCustomLookupCondition()); assertEquals(iAtDefaultContent, t.toString()); assertEquals( - ImmutableList.of("@nosuch.com/i.ftl", "@default/i.ftl"), + ImmutableList.of("@nosuch.com/i.f3ah", "@default/i.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -457,13 +457,13 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx"); final Domain domain = new Domain("foo.com"); - final Template t = cfg.getTemplate("t2.ftl", locale, domain); + final Template t = cfg.getTemplate("t2.f3ah", locale, domain); assertOutputEquals(t2XxLocaleExpectedOutput, t); assertEquals( ImmutableList.of( - "@foo.com/t2_xx.ftl", "@foo.com/t2.ftl", - "@foo.com/i2_xx.ftl", "@foo.com/i2.ftl", "@default/i2_xx.ftl", "@default/i2.ftl", - "@foo.com/i3_xx.ftl"), + "@foo.com/t2_xx.f3ah", "@foo.com/t2.f3ah", + "@foo.com/i2_xx.f3ah", "@foo.com/i2.f3ah", "@default/i2_xx.f3ah", "@default/i2.f3ah", + "@foo.com/i3_xx.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -473,13 +473,13 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("yy"); final Domain domain = new Domain("foo.com"); - final Template t = cfg.getTemplate("t2.ftl", locale, domain); + final Template t = cfg.getTemplate("t2.f3ah", locale, domain); assertOutputEquals(t2OtherLocaleExpectedOutput, t); assertEquals( ImmutableList.of( - "@foo.com/t2_yy.ftl", "@foo.com/t2.ftl", - "@foo.com/i2_yy.ftl", "@foo.com/i2.ftl", "@default/i2_yy.ftl", "@default/i2.ftl", - "@foo.com/i3_yy.ftl", "@foo.com/i3.ftl"), + "@foo.com/t2_yy.f3ah", "@foo.com/t2.f3ah", + "@foo.com/i2_yy.f3ah", "@foo.com/i2.f3ah", "@default/i2_yy.f3ah", "@default/i2.f3ah", + "@foo.com/i3_yy.f3ah", "@foo.com/i3.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -489,13 +489,13 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx"); final Domain domain = new Domain("foo.com"); - final Template t = cfgNoLocLU.getTemplate("t2.ftl", locale, domain); + final Template t = cfgNoLocLU.getTemplate("t2.f3ah", locale, domain); assertOutputEquals(t2OtherLocaleExpectedOutput, t); assertEquals( ImmutableList.of( - "@foo.com/t2.ftl", - "@foo.com/i2.ftl", "@default/i2.ftl", - "@foo.com/i3.ftl"), + "@foo.com/t2.f3ah", + "@foo.com/i2.f3ah", "@default/i2.f3ah", + "@foo.com/i3.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -505,9 +505,9 @@ public class TemplateLookupStrategyTest { { final Locale locale = new Locale("xx"); final Domain domain = new Domain("foo.com"); - cfg.getTemplate("i3.ftl", locale, domain); + cfg.getTemplate("i3.f3ah", locale, domain); assertEquals( - ImmutableList.of("@foo.com/i3_xx.ftl"), + ImmutableList.of("@foo.com/i3_xx.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -518,15 +518,15 @@ public class TemplateLookupStrategyTest { final Locale locale = new Locale("xx"); final Domain domain = new Domain("bar.com"); try { - cfg.getTemplate("i3.ftl", locale, domain); + cfg.getTemplate("i3.f3ah", locale, domain); } catch (TemplateNotFoundException e) { - assertEquals("i3.ftl", e.getTemplateName()); + assertEquals("i3.f3ah", e.getTemplateName()); assertEquals(domain, e.getCustomLookupCondition()); } assertEquals( ImmutableList.of( - "@bar.com/i3_xx.ftl", "@bar.com/i3.ftl", - "@default/i3_xx.ftl", "@default/i3.ftl"), + "@bar.com/i3_xx.f3ah", "@bar.com/i3.f3ah", + "@default/i3_xx.f3ah", "@default/i3.f3ah"), tl.getLoadNames()); tl.clearEvents(); @@ -596,17 +596,17 @@ public class TemplateLookupStrategyTest { @Test public void testParseError() throws IOException { MonitoredTemplateLoader tl = new MonitoredTemplateLoader(); - tl.putTextTemplate("test.ftl", ""); - tl.putTextTemplate("test_aa.ftl", "<#wrong>"); + tl.putTextTemplate("test.f3ah", ""); + tl.putTextTemplate("test_aa.f3ah", "<#wrong>"); Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0).templateLoader(tl).build(); try { - cfg.getTemplate("test.ftl", new Locale("aa", "BB")); + cfg.getTemplate("test.f3ah", new Locale("aa", "BB")); fail(); } catch (ParseException e) { - assertEquals("test_aa.ftl", e.getTemplateSourceName()); - assertEquals("test.ftl", e.getTemplateLookupName()); + assertEquals("test_aa.f3ah", e.getTemplateSourceName()); + assertEquals("test.f3ah", e.getTemplateLookupName()); } } http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.f3ah new file mode 100644 index 0000000..f9af656 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.f3ah @@ -0,0 +1,29 @@ +<#-- + 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. +--> +1 <@foo x=1 y=2; b1, b2>x</@foo> +2 <@ns.bar 1, 2; b1, b2>y</@> +3 <#assign x = 123><#assign x = 123 in ns><#global x = 123> +4 <#if x + 1 == 0>foo${y}bar<#else>${"static"}${'x${baaz * 10}y'}</#if> +5 <#switch x><#case 1>one<#case 2>two<#default>more</#switch> +6 <#macro foo x y=2 z=y+1 q...><#nested x, y></#macro> +7 <#function foo(x, y)><#local x = 123><#return 1></#function> +8 <#list xs as x></#list> +9 <#list xs>[<#items as x>${x}<#sep>, </#items>]<#else>None</#list> +10 <#-- A comment --> +11 <#outputFormat "XML"><#noAutoEsc>${a}<#autoEsc>${b}</#autoEsc>${c}</#noAutoEsc></#outputFormat> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.ftl deleted file mode 100644 index f9af656..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-1.ftl +++ /dev/null @@ -1,29 +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. ---> -1 <@foo x=1 y=2; b1, b2>x</@foo> -2 <@ns.bar 1, 2; b1, b2>y</@> -3 <#assign x = 123><#assign x = 123 in ns><#global x = 123> -4 <#if x + 1 == 0>foo${y}bar<#else>${"static"}${'x${baaz * 10}y'}</#if> -5 <#switch x><#case 1>one<#case 2>two<#default>more</#switch> -6 <#macro foo x y=2 z=y+1 q...><#nested x, y></#macro> -7 <#function foo(x, y)><#local x = 123><#return 1></#function> -8 <#list xs as x></#list> -9 <#list xs>[<#items as x>${x}<#sep>, </#items>]<#else>None</#list> -10 <#-- A comment --> -11 <#outputFormat "XML"><#noAutoEsc>${a}<#autoEsc>${b}</#autoEsc>${c}</#noAutoEsc></#outputFormat> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.f3ah new file mode 100644 index 0000000..c070635 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.f3ah @@ -0,0 +1,29 @@ +<#-- + 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. +--> +1 <#assign x = 1> +2 <#assign x = 1, y = 2> +3 <#assign x = 1 in ns> +4 <#assign x = 1, y = 2 in ns> +5 <#global x = 1> +6 <#global x = 1, y = 2> +<#macro m> + 7 <#local x = 1> + 8 <#local x = 1, y = 2> +</#macro> +9 <#assign a += 1, b -= 2, c *= 3, d /= 4, e %= 5, f++, g--> http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl deleted file mode 100644 index c070635..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl +++ /dev/null @@ -1,29 +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. ---> -1 <#assign x = 1> -2 <#assign x = 1, y = 2> -3 <#assign x = 1 in ns> -4 <#assign x = 1, y = 2 in ns> -5 <#global x = 1> -6 <#global x = 1, y = 2> -<#macro m> - 7 <#local x = 1> - 8 <#local x = 1, y = 2> -</#macro> -9 <#assign a += 1, b -= 2, c *= 3, d /= 4, e %= 5, f++, g--> http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.f3ah new file mode 100644 index 0000000..7051cc7 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.f3ah @@ -0,0 +1,23 @@ +<#-- + 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. +--> +${x?trim} +${x?leftPad(5)} +${x?leftPad(5, '-')} +${x?then('y', 'n')} +${x?switch(1, 11, 2, 22, 33)} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl deleted file mode 100644 index 7051cc7..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl +++ /dev/null @@ -1,23 +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. ---> -${x?trim} -${x?leftPad(5)} -${x?leftPad(5, '-')} -${x?then('y', 'n')} -${x?switch(1, 11, 2, 22, 33)} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.f3ah new file mode 100644 index 0000000..fbf6079 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.f3ah @@ -0,0 +1,36 @@ +<#-- + 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. +--> +<#if exp></#if> +<#if exp>1</#if> +<#if exp>${1}2</#if> +<#if exp><#else></#if> +<#if exp>1<#else>1</#if> +<#if exp>${1}2<#else>${1}2</#if> +<#if exp><#elseIf exp></#if> +<#if exp><#elseIf exp>1</#if> +<#attempt><#recover></#attempt> +<#attempt>1<#recover>1</#attempt> +<#list s as i></#list> +<#list s as i>1</#list> +<#list s as i><#sep></#list> +<#list s as i>1<#sep>1</#list> +<#list s><#items as i><#sep></#items></#list> +<#list s>1<#items as i>1<#sep>1</#items>1</#list> +1 +${x + y} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.ftl deleted file mode 100644 index fbf6079..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-locations.ftl +++ /dev/null @@ -1,36 +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. ---> -<#if exp></#if> -<#if exp>1</#if> -<#if exp>${1}2</#if> -<#if exp><#else></#if> -<#if exp>1<#else>1</#if> -<#if exp>${1}2<#else>${1}2</#if> -<#if exp><#elseIf exp></#if> -<#if exp><#elseIf exp>1</#if> -<#attempt><#recover></#attempt> -<#attempt>1<#recover>1</#attempt> -<#list s as i></#list> -<#list s as i>1</#list> -<#list s as i><#sep></#list> -<#list s as i>1<#sep>1</#list> -<#list s><#items as i><#sep></#items></#list> -<#list s>1<#items as i>1<#sep>1</#items>1</#list> -1 -${x + y} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.f3ah new file mode 100644 index 0000000..53716e4 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.f3ah @@ -0,0 +1,26 @@ +<#-- + 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. +--> +<#if true> + <#if true> + </#if> + <#if true> + text + </#if> + <#if true>${x}</#if> +</#if> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl deleted file mode 100644 index 53716e4..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl +++ /dev/null @@ -1,26 +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. ---> -<#if true> - <#if true> - </#if> - <#if true> - text - </#if> - <#if true>${x}</#if> -</#if> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.f3ah ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.f3ah b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.f3ah new file mode 100644 index 0000000..501802a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.f3ah @@ -0,0 +1,33 @@ +<#-- + 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 +<#compress></#compress> +b +<#compress></#compress> +<#compress></#compress> +c +<#compress></#compress> +<#compress></#compress> +<#compress></#compress> +d +<#if true> + <#compress></#compress> + <#compress></#compress> + <#compress></#compress> +</#if> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/freemarker/blob/81b48221/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl deleted file mode 100644 index 501802a..0000000 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl +++ /dev/null @@ -1,33 +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. ---> -a -<#compress></#compress> -b -<#compress></#compress> -<#compress></#compress> -c -<#compress></#compress> -<#compress></#compress> -<#compress></#compress> -d -<#if true> - <#compress></#compress> - <#compress></#compress> - <#compress></#compress> -</#if> \ No newline at end of file