http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/FileTestCase.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/FileTestCase.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/FileTestCase.java deleted file mode 100644 index b7e4c1d..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/FileTestCase.java +++ /dev/null @@ -1,217 +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. - */ - -package org.apache.freemarker.test.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.freemarker.core.util._NullArgumentException; -import org.apache.freemarker.core.util._StringUtil; -import org.apache.freemarker.test.TestUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; - -/** - * Test case that needs to compare a string to a reference (expected) text file, or two text files. - */ -public abstract class FileTestCase extends TestCase { - - public static final Logger LOG = LoggerFactory.getLogger(FileTestCase.class); - - public FileTestCase(String name) { - super(name); - } - - protected void assertExpectedFileEqualsString(String expectedFileName, String actualContent) { - try { - final URL expectedFile = getExpectedContentFileURL(expectedFileName); - - try { - multilineAssertEquals(loadTestTextResource(expectedFile), actualContent); - } catch (AssertionFailedError | FileNotFoundException e) { - File actualFile = getActualContentFileFor(expectedFile); - if (actualFile != null) { - FileUtils.write(actualFile, actualContent); - reportActualFileSaved(actualFile); - } - - throw e; - } - } catch (IOException e) { - throw new RuntimeException("Failed to do assertion", e); - } - } - - private void multilineAssertEquals(String expected, String actual) { - String normExpected = _StringUtil.normalizeEOLs(expected); - final String normActual = _StringUtil.normalizeEOLs(actual); - - // Ignore final line-break difference: - if (normActual.endsWith("\n") && !normExpected.endsWith("\n")) { - normExpected += "\n"; - } else if (!normActual.endsWith("\n") && normExpected.endsWith("\n")) { - normExpected = normExpected.substring(0, normExpected.length() - 1); - } - - assertEquals(normExpected, normActual); - } - - protected void reportActualFileSaved(File actualContentFile) { - LOG.info("Saved actual output of the failed test to here: {}", actualContentFile.getAbsolutePath()); - } - - /** - * Convenience method for calling {@link #getTestFileURL(String, String)} with {@link - * #getExpectedContentFileDirectoryResourcePath()} as the first argument. - */ - protected final URL getExpectedContentFileURL(String expectedContentFileName) throws IOException { - return getTestFileURL(getExpectedContentFileDirectoryResourcePath(), expectedContentFileName); - } - - /** - * Gets the URL of the test file that contains the expected result. - * - * @param directoryResourcePath - * The class-loader resource path of the containing directory; if relative, it's interpreted relatively to - * the package of {@link #getTestResourcesBaseClass()}. - * - * @return Not {@code null}; if the file isn't found, throw {@link FileNotFoundException} - * - * @throws FileNotFoundException - * If the requested file wasn't found. - */ - protected final URL getTestFileURL(String directoryResourcePath, String fileName) throws IOException { - _NullArgumentException.check("directoryResourcePath", directoryResourcePath); - _NullArgumentException.check("testCaseFileName", fileName); - - Class baseClass = getTestResourcesBaseClass(); - String resourcePath = joinResourcePaths(directoryResourcePath, fileName); - // It's important that we only query an URL for the file (not for the parent package directory), because the - // parent URL can depend on the file name if the class loader uses multiple directories/jars. - URL resource = baseClass.getResource(resourcePath); - if (resource == null) { - throw new FileNotFoundException("Class-loader resource not found for: " - + "baseClass: " + baseClass.getName() + "; " - + "resourcePath (shown quoted): " + _StringUtil.jQuote(resourcePath)); - } - return resource; - } - - /** - * Concatenates two resource paths, taking care of the edge cases due to leading and trailing "/" - * characters in them. - */ - protected final String joinResourcePaths(String dirPath, String tailPath) { - if (tailPath.startsWith("/") || dirPath.isEmpty()) { - return tailPath; - } - return dirPath.endsWith("/") ? dirPath + tailPath : dirPath + "/" + tailPath; - } - - /** - * Gets the actual content file to create which belongs to an expected content file. Actual content files are - * created when the expected and the actual content differs. - * - * @return {@code null} if there's no place to write the files that contain the actual content - */ - protected File getActualContentFileFor(URL expectedContentFile) throws IOException { - _NullArgumentException.check("expectedContentFile", expectedContentFile); - - File actualContentFileDir = getActualContentFileDirectory(expectedContentFile); - if (actualContentFileDir == null) { - return null; - } - - String expectedContentFileName = expectedContentFile.getPath(); - int lastSlashIdx = expectedContentFileName.lastIndexOf('/'); - if (lastSlashIdx != -1) { - expectedContentFileName = expectedContentFileName.substring(lastSlashIdx + 1); - } - - return new File(actualContentFileDir, deduceActualContentFileName(expectedContentFileName)); - } - - /** - * Deduces the actual content file name from the expected content file name. - * - * @return Not {@code null} - */ - protected String deduceActualContentFileName(String expectedContentFileName) { - _NullArgumentException.check("expectedContentFileName", expectedContentFileName); - - int lastDotIdx = expectedContentFileName.lastIndexOf('.'); - return lastDotIdx == -1 - ? expectedContentFileName + ".actual" - : expectedContentFileName.substring(0, lastDotIdx) + "-actual" + expectedContentFileName.substring(lastDotIdx); - } - - /** - * The class loader resource path of the directory that contains the expected files; must start and end with "/"! - */ - protected String getExpectedContentFileDirectoryResourcePath() throws IOException { - return getTestClassDirectoryResourcePath(); - } - - /** - * @return {@code null} if there's no directory to write the actual files to - */ - protected File getActualContentFileDirectory(URL expectedFile) throws IOException { - return FileUtils.toFile(expectedFile).getParentFile(); - } - - /** - * The class loader resource path of the directory that contains the test files; must not end with "/"! - */ - protected String getTestClassDirectoryResourcePath() throws IOException { - return ""; - } - - /** - * Resource paths are loaded using this class's {@link Class#getResourceAsStream(String)} method; thus, if - * {@link #getTestClassDirectoryResourcePath()} and such return a relative paths, they will be relative to the - * package of this class. - */ - protected Class getTestResourcesBaseClass() { - return getClass(); - } - - protected String loadTestTextResource(URL resource) throws IOException { - return loadTestTextResource(resource, getTestResourceDefaultCharset()); - } - - protected String loadTestTextResource(URL resource, Charset charset) throws IOException { - return TestUtil.removeTxtCopyrightComment( - IOUtils.toString(resource, charset.name())); - } - - protected Charset getTestResourceDefaultCharset() { - return StandardCharsets.UTF_8; - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java deleted file mode 100644 index 0bc37a3..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/MissingRequiredParameterException.java +++ /dev/null @@ -1,51 +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. - */ - -package org.apache.freemarker.test.util; - -import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.util._StringUtil; - -/** - * Indicates that a named directive/function parameter is missing. - * This is will be public and go into the org.apache.freemarker.core.ast when the directive/method stuff was reworked. - */ -class MissingRequiredParameterException extends ParameterException { - - public MissingRequiredParameterException(String parameterName, Environment env) { - this(parameterName, null, null, env); - } - - public MissingRequiredParameterException(String parameterName, Exception cause, Environment env) { - this(parameterName, null, cause, env); - } - - public MissingRequiredParameterException(String parameterName, String description, Environment env) { - this(parameterName, description, null, env); - } - - public MissingRequiredParameterException(String parameterName, String description, Exception cause, Environment env) { - super(parameterName, - "Required parameter " + _StringUtil.jQuote(parameterName) + " is missing, " - + "or the parameter value was null." - + (description != null ? " " + _StringUtil.jQuote(description) : ""), - cause, env); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java deleted file mode 100644 index d504bd5..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/NoOutputDirective.java +++ /dev/null @@ -1,50 +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. - */ - -package org.apache.freemarker.test.util; - -import java.io.IOException; -import java.util.Map; - -import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.TemplateException; -import org.apache.freemarker.core.model.TemplateDirectiveBody; -import org.apache.freemarker.core.model.TemplateDirectiveModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelException; -import org.apache.freemarker.core.util._NullWriter; - -public class NoOutputDirective implements TemplateDirectiveModel { - - public static final NoOutputDirective INSTANCE = new NoOutputDirective(); - - private NoOutputDirective() { - // - } - - @Override - public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) - throws TemplateException, IOException { - if (!params.isEmpty()) { - throw new TemplateModelException("This directivey doesn't support any parameters."); - } - body.render(_NullWriter.INSTANCE); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/ParameterException.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/ParameterException.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/ParameterException.java deleted file mode 100644 index 47220d5..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/ParameterException.java +++ /dev/null @@ -1,54 +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. - */ - -package org.apache.freemarker.test.util; - -import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.TemplateException; - -/** - * An exception that is related to a named parameter of a directive or function. - * This is will be public and go into the org.apache.freemarker.core.ast when the method/directive stuff was reworked. - */ -abstract class ParameterException extends TemplateException { - - private final String parameterName; - - public ParameterException(String parameterName, Environment env) { - this(parameterName, null, null, env); - } - - public ParameterException(String parameterName, Exception cause, Environment env) { - this(parameterName, null, cause, env); - } - - public ParameterException(String parameterName, String description, Environment env) { - this(parameterName, description, null, env); - } - - public ParameterException(String parameterName, String description, Exception cause, Environment env) { - super(description, cause, env); - this.parameterName = parameterName; - } - - public String getParameterName() { - return parameterName; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/SimpleMapAndCollectionObjectWrapper.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/SimpleMapAndCollectionObjectWrapper.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/SimpleMapAndCollectionObjectWrapper.java deleted file mode 100644 index c1da1c4..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/SimpleMapAndCollectionObjectWrapper.java +++ /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. - */ -package org.apache.freemarker.test.util; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; - -import org.apache.freemarker.core.Version; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelException; -import org.apache.freemarker.core.model.impl.DefaultObjectWrapper; -import org.apache.freemarker.core.model.impl.SimpleHash; -import org.apache.freemarker.core.model.impl.SimpleSequence; - -/** - * Forces using "simple" models for {@link Map}-s, {@link Collection}-s and arrays. This is mostly useful for template - * test cases that wish to test with these models, but otherwise need to able to wrap beans and such. - */ -public class SimpleMapAndCollectionObjectWrapper extends DefaultObjectWrapper { - - public SimpleMapAndCollectionObjectWrapper(Version incompatibleImprovements) { - super(new DefaultObjectWrapper.Builder(incompatibleImprovements), true); - } - - @Override - public TemplateModel wrap(Object obj) throws TemplateModelException { - if (obj == null) { - return super.wrap(null); - } - if (obj.getClass().isArray()) { - obj = Arrays.asList((Object[]) obj); - } - if (obj instanceof Collection) { - return new SimpleSequence((Collection<?>) obj, this); - } - if (obj instanceof Map) { - return new SimpleHash((Map<?, ?>) obj, this); - } - - return super.wrap(obj); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java deleted file mode 100644 index ac4d528..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/UnsupportedParameterException.java +++ /dev/null @@ -1,50 +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. - */ - -package org.apache.freemarker.test.util; - -import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.util._StringUtil; - -/** - * Indicates that a named directive/function parameter is unsupported (like a typo). - * This is will be public and go into the org.apache.freemarker.core.ast when the directive/method stuff was reworked. - */ -class UnsupportedParameterException extends ParameterException { - - public UnsupportedParameterException(String parameterName, Environment env) { - this(parameterName, null, null, env); - } - - public UnsupportedParameterException(String parameterName, Exception cause, Environment env) { - this(parameterName, null, cause, env); - } - - public UnsupportedParameterException(String parameterName, String description, Environment env) { - this(parameterName, description, null, env); - } - - public UnsupportedParameterException(String parameterName, String description, Exception cause, Environment env) { - super(parameterName, - "Unsuppored parameter: " + _StringUtil.jQuote(parameterName) - + (description == null ? "." : ". " + _StringUtil.jQuote(description)), - cause, env); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/java/org/apache/freemarker/test/util/XMLLoader.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/java/org/apache/freemarker/test/util/XMLLoader.java b/freemarker-core/src/test/java/org/apache/freemarker/test/util/XMLLoader.java deleted file mode 100644 index 90763a0..0000000 --- a/freemarker-core/src/test/java/org/apache/freemarker/test/util/XMLLoader.java +++ /dev/null @@ -1,138 +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. - */ - -package org.apache.freemarker.test.util; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.net.MalformedURLException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.freemarker.dom.NodeModel; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public final class XMLLoader { - - private static final Object STATIC_LOCK = new Object(); - - static private DocumentBuilderFactory docBuilderFactory; - - private XMLLoader() { - // - } - - /** - * Convenience method to invoke a {@link NodeModel} from a SAX {@link InputSource}. - */ - static public NodeModel toModel(InputSource is, boolean simplify) - throws SAXException, IOException, ParserConfigurationException { - DocumentBuilder builder = getDocumentBuilderFactory().newDocumentBuilder(); - final Document doc; - try { - doc = builder.parse(is); - } catch (MalformedURLException e) { - // This typical error has an error message that is hard to understand, so let's translate it: - if (is.getSystemId() == null && is.getCharacterStream() == null && is.getByteStream() == null) { - throw new MalformedURLException( - "The SAX InputSource has systemId == null && characterStream == null && byteStream == null. " - + "This is often because it was created with a null InputStream or Reader, which is often because " - + "the XML file it should point to was not found. " - + "(The original exception was: " + e + ")"); - } else { - throw e; - } - } - if (simplify) { - NodeModel.simplify(doc); - } - return NodeModel.wrap(doc); - } - - /** - * Same as {@link #toModel(InputSource, boolean) parse(is, true)}. - */ - static public NodeModel toModel(InputSource is) throws SAXException, IOException, ParserConfigurationException { - return toModel(is, true); - } - - /** - * Same as {@link #toModel(InputSource, boolean)}, but loads from a {@link File}; don't miss the security - * warnings documented there. - */ - static public NodeModel toModel(File f, boolean simplify) - throws SAXException, IOException, ParserConfigurationException { - DocumentBuilder builder = getDocumentBuilderFactory().newDocumentBuilder(); - Document doc = builder.parse(f); - if (simplify) { - NodeModel.simplify(doc); - } - return NodeModel.wrap(doc); - } - - /** - * Same as {@link #toModel(InputSource, boolean) parse(source, true)}, but loads from a {@link String}. - */ - static public NodeModel toModel(File f) throws SAXException, IOException, ParserConfigurationException { - return toModel(f, true); - } - - /** - * Same as {@link #toModel(InputSource, boolean)}, but loads from a {@link File}; don't miss the security - * warnings documented there. - */ - static public NodeModel toModel(String content, boolean simplify) - throws SAXException, IOException, ParserConfigurationException { - return toModel(toInputSource(content)); - } - - /** - * Same as {@link #toModel(InputSource, boolean) parse(source, true)}, but loads from a {@link String}. - */ - static public NodeModel toModel(String content) throws SAXException, IOException, ParserConfigurationException { - return toModel(content, true); - } - - public static Document toDOM(String content) throws SAXException, IOException, ParserConfigurationException { - DocumentBuilder builder = getDocumentBuilderFactory().newDocumentBuilder(); - return builder.parse(toInputSource(content)); - } - - static private DocumentBuilderFactory getDocumentBuilderFactory() { - synchronized (STATIC_LOCK) { - if (docBuilderFactory == null) { - DocumentBuilderFactory newFactory = DocumentBuilderFactory.newInstance(); - newFactory.setNamespaceAware(true); - newFactory.setIgnoringElementContentWhitespace(true); - docBuilderFactory = newFactory; // We only write it out when the initialization was full - } - return docBuilderFactory; - } - } - - private static InputSource toInputSource(String content) { - return new InputSource(new StringReader(content)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ast deleted file mode 100644 index 1cdd496..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ast +++ /dev/null @@ -1,187 +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. - */ -#mixed_content // o.a.f.c.ASTImplicitParent - #text // o.a.f.c.ASTStaticText - - content: "1 " // String - @ // o.a.f.c.ASTDirUserDefined - - callee: foo // o.a.f.c.ASTExpVariable - - argument name: "x" // String - - argument value: 1 // o.a.f.c.ASTExpNumberLiteral - - argument name: "y" // String - - argument value: 2 // o.a.f.c.ASTExpNumberLiteral - - target loop variable: "b1" // String - - target loop variable: "b2" // String - #text // o.a.f.c.ASTStaticText - - content: "x" // String - #text // o.a.f.c.ASTStaticText - - content: "\n2 " // String - @ // o.a.f.c.ASTDirUserDefined - - callee: . // o.a.f.c.ASTExpDot - - left-hand operand: ns // o.a.f.c.ASTExpVariable - - right-hand operand: "bar" // String - - argument value: 1 // o.a.f.c.ASTExpNumberLiteral - - argument value: 2 // o.a.f.c.ASTExpNumberLiteral - - target loop variable: "b1" // String - - target loop variable: "b2" // String - #text // o.a.f.c.ASTStaticText - - content: "y" // String - #text // o.a.f.c.ASTStaticText - - content: "\n3 " // String - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 123 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 123 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: ns // o.a.f.c.ASTExpVariable - #global // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 123 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "3" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n4 " // String - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer - #if // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: == // o.a.f.c.ASTExpComparison - - left-hand operand: + // o.a.f.c.ASTExpAddOrConcat - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: 1 // o.a.f.c.ASTExpNumberLiteral - - right-hand operand: 0 // o.a.f.c.ASTExpNumberLiteral - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText - - content: "foo" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: y // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "bar" // String - #else // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: null // Null - - AST-node subtype: "1" // Integer - ${...} // o.a.f.c.ASTDollarInterpolation - - content: "static" // o.a.f.c.ASTExpStringLiteral - ${...} // o.a.f.c.ASTDollarInterpolation - - content: dynamic "..." // o.a.f.c.ASTExpStringLiteral - - value part: "x" // String - - value part: ${...} // o.a.f.c.ASTDollarInterpolation - - content: * // o.a.f.c.ArithmeticExpression - - left-hand operand: baaz // o.a.f.c.ASTExpVariable - - right-hand operand: 10 // o.a.f.c.ASTExpNumberLiteral - - AST-node subtype: "1" // Integer - - value part: "y" // String - #text // o.a.f.c.ASTStaticText - - content: "\n5 " // String - #switch // o.a.f.c.ASTDirSwitch - - value: x // o.a.f.c.ASTExpVariable - #case // o.a.f.c.ASTDirCase - - condition: 1 // o.a.f.c.ASTExpNumberLiteral - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText - - content: "one" // String - #case // o.a.f.c.ASTDirCase - - condition: 2 // o.a.f.c.ASTExpNumberLiteral - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText - - content: "two" // String - #default // o.a.f.c.ASTDirCase - - condition: null // Null - - AST-node subtype: "1" // Integer - #text // o.a.f.c.ASTStaticText - - content: "more" // String - #text // o.a.f.c.ASTStaticText - - content: "\n6 " // String - #macro // o.a.f.c.ASTDirMacro - - assignment target: "foo" // String - - parameter name: "x" // String - - parameter default: null // Null - - parameter name: "y" // String - - parameter default: 2 // o.a.f.c.ASTExpNumberLiteral - - parameter name: "z" // String - - parameter default: + // o.a.f.c.ASTExpAddOrConcat - - left-hand operand: y // o.a.f.c.ASTExpVariable - - right-hand operand: 1 // o.a.f.c.ASTExpNumberLiteral - - catch-all parameter name: "q" // String - - AST-node subtype: "0" // Integer - #nested // o.a.f.c.ASTDirNested - - passed value: x // o.a.f.c.ASTExpVariable - - passed value: y // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "\n7 " // String - #function // o.a.f.c.ASTDirMacro - - assignment target: "foo" // String - - parameter name: "x" // String - - parameter default: null // Null - - parameter name: "y" // String - - parameter default: null // Null - - catch-all parameter name: null // Null - - AST-node subtype: "1" // Integer - #local // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 123 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "2" // Integer - - namespace: null // Null - #return // o.a.f.c.ASTDirReturn - - value: 1 // o.a.f.c.ASTExpNumberLiteral - #text // o.a.f.c.ASTStaticText - - content: "\n8 " // String - #list // o.a.f.c.ASTDirList - - list source: xs // o.a.f.c.ASTExpVariable - - target loop variable: "x" // String - #text // o.a.f.c.ASTStaticText - - content: "\n9 " // String - #list-#else-container // o.a.f.c.ASTDirListElseContainer - #list // o.a.f.c.ASTDirList - - list source: xs // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "[" // String - #items // o.a.f.c.ASTDirItems - - target loop variable: "x" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: x // o.a.f.c.ASTExpVariable - #sep // o.a.f.c.ASTDirSep - #text // o.a.f.c.ASTStaticText - - content: ", " // String - #text // o.a.f.c.ASTStaticText - - content: "]" // String - #else // o.a.f.c.ASTDirElseOfList - #text // o.a.f.c.ASTStaticText - - content: "None" // String - #text // o.a.f.c.ASTStaticText - - content: "\n10 " // String - #--...-- // o.a.f.c.ASTComment - - content: " A comment " // String - #text // o.a.f.c.ASTStaticText - - content: "\n11 " // String - #outputformat // o.a.f.c.ASTDirOutputFormat - - value: "XML" // o.a.f.c.ASTExpStringLiteral - #noautoesc // o.a.f.c.ASTDirNoAutoEsc - ${...} // o.a.f.c.ASTDollarInterpolation - - content: a // o.a.f.c.ASTExpVariable - #autoesc // o.a.f.c.ASTDirAutoEsc - ${...} // o.a.f.c.ASTDollarInterpolation - - content: b // o.a.f.c.ASTExpVariable - ${...} // o.a.f.c.ASTDollarInterpolation - - content: c // o.a.f.c.ASTExpVariable http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-1.ftl deleted file mode 100644 index 8c8953a..0000000 --- a/freemarker-core/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/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ast deleted file mode 100644 index 4839892..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ast +++ /dev/null @@ -1,172 +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. - */ -#mixed_content // o.a.f.c.ASTImplicitParent - #text // o.a.f.c.ASTStaticText - - content: "1 " // String - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n2 " // String - #assign // o.a.f.c.ASTDirAssignmentsContainer - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "y" // String - - assignment operator: "=" // String - - assignment source: 2 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n3 " // String - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: ns // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "\n4 " // String - #assign // o.a.f.c.ASTDirAssignmentsContainer - - variable scope: "1" // Integer - - namespace: ns // o.a.f.c.ASTExpVariable - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: ns // o.a.f.c.ASTExpVariable - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "y" // String - - assignment operator: "=" // String - - assignment source: 2 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: ns // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "\n5 " // String - #global // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "3" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n6 " // String - #global // o.a.f.c.ASTDirAssignmentsContainer - - variable scope: "3" // Integer - - namespace: null // Null - #global // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "3" // Integer - - namespace: null // Null - #global // o.a.f.c.ASTDirAssignment - - assignment target: "y" // String - - assignment operator: "=" // String - - assignment source: 2 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "3" // Integer - - namespace: null // Null - #macro // o.a.f.c.ASTDirMacro - - assignment target: "m" // String - - catch-all parameter name: null // Null - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText - - content: " 7 " // String - #local // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "2" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n 8 " // String - #local // o.a.f.c.ASTDirAssignmentsContainer - - variable scope: "2" // Integer - - namespace: null // Null - #local // o.a.f.c.ASTDirAssignment - - assignment target: "x" // String - - assignment operator: "=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "2" // Integer - - namespace: null // Null - #local // o.a.f.c.ASTDirAssignment - - assignment target: "y" // String - - assignment operator: "=" // String - - assignment source: 2 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "2" // Integer - - namespace: null // Null - #text // o.a.f.c.ASTStaticText - - content: "\n" // String - #text // o.a.f.c.ASTStaticText - - content: "9 " // String - #assign // o.a.f.c.ASTDirAssignmentsContainer - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "a" // String - - assignment operator: "+=" // String - - assignment source: 1 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "b" // String - - assignment operator: "-=" // String - - assignment source: 2 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "c" // String - - assignment operator: "*=" // String - - assignment source: 3 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "d" // String - - assignment operator: "/=" // String - - assignment source: 4 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "e" // String - - assignment operator: "%=" // String - - assignment source: 5 // o.a.f.c.ASTExpNumberLiteral - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "f" // String - - assignment operator: "++" // String - - assignment source: null // Null - - variable scope: "1" // Integer - - namespace: null // Null - #assign // o.a.f.c.ASTDirAssignment - - assignment target: "g" // String - - assignment operator: "--" // String - - assignment source: null // Null - - variable scope: "1" // Integer - - namespace: null // Null http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-assignments.ftl deleted file mode 100644 index c070635..0000000 --- a/freemarker-core/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/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ast deleted file mode 100644 index b8b696f..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ast +++ /dev/null @@ -1,59 +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. - */ -#mixed_content // o.a.f.c.ASTImplicitParent - ${...} // o.a.f.c.ASTDollarInterpolation - - content: ?trim // o.a.f.c.BuiltInsForStringsBasic$trimBI - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: "trim" // String - #text // o.a.f.c.ASTStaticText - - content: "\n" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: ...(...) // o.a.f.c.ASTExpMethodCall - - callee: ?left_pad // o.a.f.c.BuiltInsForStringsBasic$padBI - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: "left_pad" // String - - argument value: 5 // o.a.f.c.ASTExpNumberLiteral - #text // o.a.f.c.ASTStaticText - - content: "\n" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: ...(...) // o.a.f.c.ASTExpMethodCall - - callee: ?left_pad // o.a.f.c.BuiltInsForStringsBasic$padBI - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: "left_pad" // String - - argument value: 5 // o.a.f.c.ASTExpNumberLiteral - - argument value: "-" // o.a.f.c.ASTExpStringLiteral - #text // o.a.f.c.ASTStaticText - - content: "\n" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: ?then(...) // o.a.f.c.BuiltInsWithParseTimeParameters$then_BI - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: "then" // String - - argument value: "y" // o.a.f.c.ASTExpStringLiteral - - argument value: "n" // o.a.f.c.ASTExpStringLiteral - #text // o.a.f.c.ASTStaticText - - content: "\n" // String - ${...} // o.a.f.c.ASTDollarInterpolation - - content: ?switch(...) // o.a.f.c.BuiltInsWithParseTimeParameters$switch_BI - - left-hand operand: x // o.a.f.c.ASTExpVariable - - right-hand operand: "switch" // String - - argument value: 1 // o.a.f.c.ASTExpNumberLiteral - - argument value: 11 // o.a.f.c.ASTExpNumberLiteral - - argument value: 2 // o.a.f.c.ASTExpNumberLiteral - - argument value: 22 // o.a.f.c.ASTExpNumberLiteral - - argument value: 33 // o.a.f.c.ASTExpNumberLiteral http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-builtins.ftl deleted file mode 100644 index 74aee52..0000000 --- a/freemarker-core/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?left_pad(5)} -${x?left_pad(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/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ast deleted file mode 100644 index 7770d72..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ast +++ /dev/null @@ -1,155 +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. - */ -#mixed_content // o.a.f.c.ASTImplicitParent; Location 1:1-18:8 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 1:1-1:15 - - condition: exp // o.a.f.c.ASTExpVariable; Location 1:6-1:8 - - AST-node subtype: "0" // Integer - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 2:1-2:16 - - condition: exp // o.a.f.c.ASTExpVariable; Location 2:6-2:8 - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText; Location 2:10-2:10 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 2:17-2:17 - - content: "\n" // String - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 3:1-3:20 - - condition: exp // o.a.f.c.ASTExpVariable; Location 3:6-3:8 - - AST-node subtype: "0" // Integer - ${...} // o.a.f.c.ASTDollarInterpolation; Location 3:10-3:13 - - content: 1 // o.a.f.c.ASTExpNumberLiteral; Location 3:12-3:12 - #text // o.a.f.c.ASTStaticText; Location 3:14-3:14 - - content: "2" // String - #text // o.a.f.c.ASTStaticText; Location 3:21-3:21 - - content: "\n" // String - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer; Location 4:1-4:22 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 4:1-4:9 - - condition: exp // o.a.f.c.ASTExpVariable; Location 4:6-4:8 - - AST-node subtype: "0" // Integer - #else // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 4:10-4:16 - - condition: null // Null - - AST-node subtype: "1" // Integer - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer; Location 5:1-5:24 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 5:1-5:10 - - condition: exp // o.a.f.c.ASTExpVariable; Location 5:6-5:8 - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText; Location 5:10-5:10 - - content: "1" // String - #else // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 5:11-5:18 - - condition: null // Null - - AST-node subtype: "1" // Integer - #text // o.a.f.c.ASTStaticText; Location 5:18-5:18 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 5:25-5:25 - - content: "\n" // String - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer; Location 6:1-6:32 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 6:1-6:14 - - condition: exp // o.a.f.c.ASTExpVariable; Location 6:6-6:8 - - AST-node subtype: "0" // Integer - ${...} // o.a.f.c.ASTDollarInterpolation; Location 6:10-6:13 - - content: 1 // o.a.f.c.ASTExpNumberLiteral; Location 6:12-6:12 - #text // o.a.f.c.ASTStaticText; Location 6:14-6:14 - - content: "2" // String - #else // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 6:15-6:26 - - condition: null // Null - - AST-node subtype: "1" // Integer - ${...} // o.a.f.c.ASTDollarInterpolation; Location 6:22-6:25 - - content: 1 // o.a.f.c.ASTExpNumberLiteral; Location 6:24-6:24 - #text // o.a.f.c.ASTStaticText; Location 6:26-6:26 - - content: "2" // String - #text // o.a.f.c.ASTStaticText; Location 6:33-6:33 - - content: "\n" // String - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer; Location 7:1-7:28 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 7:1-7:9 - - condition: exp // o.a.f.c.ASTExpVariable; Location 7:6-7:8 - - AST-node subtype: "0" // Integer - #elseif // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 7:10-7:22 - - condition: exp // o.a.f.c.ASTExpVariable; Location 7:19-7:21 - - AST-node subtype: "2" // Integer - #if-#elseif-#else-container // o.a.f.c.ASTDirIfElseIfElseContainer; Location 8:1-8:29 - #if // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 8:1-8:9 - - condition: exp // o.a.f.c.ASTExpVariable; Location 8:6-8:8 - - AST-node subtype: "0" // Integer - #elseif // o.a.f.c.ASTDirIfOrElseOrElseIf; Location 8:10-8:23 - - condition: exp // o.a.f.c.ASTExpVariable; Location 8:19-8:21 - - AST-node subtype: "2" // Integer - #text // o.a.f.c.ASTStaticText; Location 8:23-8:23 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 8:30-8:30 - - content: "\n" // String - #attempt // o.a.f.c.ASTDirAttemptRecoverContainer; Location 9:1-9:31 - - error handler: #recover // o.a.f.c.ASTDirRecover; Location 9:11-9:20 - #recover // o.a.f.c.ASTDirRecover; Location 9:11-9:20 - #attempt // o.a.f.c.ASTDirAttemptRecoverContainer; Location 10:1-10:33 - - error handler: #recover // o.a.f.c.ASTDirRecover; Location 10:12-10:22 - #text // o.a.f.c.ASTStaticText; Location 10:22-10:22 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 10:11-10:11 - - content: "1" // String - #recover // o.a.f.c.ASTDirRecover; Location 10:12-10:22 - #text // o.a.f.c.ASTStaticText; Location 10:22-10:22 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 10:34-10:34 - - content: "\n" // String - #list // o.a.f.c.ASTDirList; Location 11:1-11:22 - - list source: s // o.a.f.c.ASTExpVariable; Location 11:8-11:8 - - target loop variable: "i" // String - #list // o.a.f.c.ASTDirList; Location 12:1-12:23 - - list source: s // o.a.f.c.ASTExpVariable; Location 12:8-12:8 - - target loop variable: "i" // String - #text // o.a.f.c.ASTStaticText; Location 12:15-12:15 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 12:24-12:24 - - content: "\n" // String - #list // o.a.f.c.ASTDirList; Location 13:1-13:28 - - list source: s // o.a.f.c.ASTExpVariable; Location 13:8-13:8 - - target loop variable: "i" // String - #sep // o.a.f.c.ASTDirSep; Location 13:15-13:20 - #list // o.a.f.c.ASTDirList; Location 14:1-14:30 - - list source: s // o.a.f.c.ASTExpVariable; Location 14:8-14:8 - - target loop variable: "i" // String - #text // o.a.f.c.ASTStaticText; Location 14:15-14:15 - - content: "1" // String - #sep // o.a.f.c.ASTDirSep; Location 14:16-14:22 - #text // o.a.f.c.ASTStaticText; Location 14:22-14:22 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 14:31-14:31 - - content: "\n" // String - #list // o.a.f.c.ASTDirList; Location 15:1-15:45 - - list source: s // o.a.f.c.ASTExpVariable; Location 15:8-15:8 - #items // o.a.f.c.ASTDirItems; Location 15:10-15:37 - - target loop variable: "i" // String - #sep // o.a.f.c.ASTDirSep; Location 15:23-15:28 - #list // o.a.f.c.ASTDirList; Location 16:1-16:49 - - list source: s // o.a.f.c.ASTExpVariable; Location 16:8-16:8 - #text // o.a.f.c.ASTStaticText; Location 16:10-16:10 - - content: "1" // String - #items // o.a.f.c.ASTDirItems; Location 16:11-16:40 - - target loop variable: "i" // String - #text // o.a.f.c.ASTStaticText; Location 16:24-16:24 - - content: "1" // String - #sep // o.a.f.c.ASTDirSep; Location 16:25-16:31 - #text // o.a.f.c.ASTStaticText; Location 16:31-16:31 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 16:41-16:41 - - content: "1" // String - #text // o.a.f.c.ASTStaticText; Location 16:50-17:2 - - content: "\n1\n" // String - ${...} // o.a.f.c.ASTDollarInterpolation; Location 18:1-18:8 - - content: + // o.a.f.c.ASTExpAddOrConcat; Location 18:3-18:7 - - left-hand operand: x // o.a.f.c.ASTExpVariable; Location 18:3-18:3 - - right-hand operand: y // o.a.f.c.ASTExpVariable; Location 18:7-18:7 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-locations.ftl deleted file mode 100644 index 99fa244..0000000 --- a/freemarker-core/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/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ast deleted file mode 100644 index 41fc90b..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ast +++ /dev/null @@ -1,38 +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 // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: true // o.a.f.c.ASTExpBooleanLiteral - - AST-node subtype: "0" // Integer - #if // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: true // o.a.f.c.ASTExpBooleanLiteral - - AST-node subtype: "0" // Integer - #if // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: true // o.a.f.c.ASTExpBooleanLiteral - - AST-node subtype: "0" // Integer - #text // o.a.f.c.ASTStaticText - - content: " text\n" // String - #text // o.a.f.c.ASTStaticText - - content: " " // String - #if // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: true // o.a.f.c.ASTExpBooleanLiteral - - AST-node subtype: "0" // Integer - ${...} // o.a.f.c.ASTDollarInterpolation - - content: x // o.a.f.c.ASTExpVariable - #text // o.a.f.c.ASTStaticText - - content: "\n" // String http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-mixedcontentsimplifications.ftl deleted file mode 100644 index 53716e4..0000000 --- a/freemarker-core/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/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ast deleted file mode 100644 index 7675522..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ast +++ /dev/null @@ -1,30 +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. - */ -#mixed_content // o.a.f.c.ASTImplicitParent - #text // o.a.f.c.ASTStaticText - - content: "a\n" // String - #text // o.a.f.c.ASTStaticText - - content: "b\n" // String - #text // o.a.f.c.ASTStaticText - - content: "c\n" // String - #text // o.a.f.c.ASTStaticText - - content: "d\n" // String - #if // o.a.f.c.ASTDirIfOrElseOrElseIf - - condition: true // o.a.f.c.ASTExpBooleanLiteral - - AST-node subtype: "0" // Integer http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-multipleignoredchildren.ftl deleted file mode 100644 index 501802a..0000000 --- a/freemarker-core/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 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ast ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ast b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ast deleted file mode 100644 index eefa5b1..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ast +++ /dev/null @@ -1,20 +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. - */ -#outputformat // o.a.f.c.ASTDirOutputFormat - - value: "HTML" // o.a.f.c.ASTExpStringLiteral http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ftl b/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ftl deleted file mode 100644 index fbdb342..0000000 --- a/freemarker-core/src/test/resources/org/apache/freemarker/core/ast-nestedignoredchildren.ftl +++ /dev/null @@ -1,19 +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. ---> -<#outputFormat 'HTML'><#outputFormat 'HTML'><#outputFormat 'HTML'></#outputFormat></#outputFormat></#outputFormat> \ No newline at end of file
