From be2ce15facec2e8e7682fe04dc607aa0403808db Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Sun, 1 Sep 2019 12:10:11 -0400 Subject: [PATCH 1/7] #422: Added inline verbatim description to Verbatim tag documentation --- .../src/orchid/resources/wiki/tag/verbatim.md | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/src/orchid/resources/wiki/tag/verbatim.md b/docs/src/orchid/resources/wiki/tag/verbatim.md index 6c2c48f09..c67b7f27d 100644 --- a/docs/src/orchid/resources/wiki/tag/verbatim.md +++ b/docs/src/orchid/resources/wiki/tag/verbatim.md @@ -1,9 +1,25 @@ # `verbatim` -The `verbatim` tag allows you to write Pebble syntax that won't be parsed. +The `verbatim` tag allows you to write a block of Pebble syntax that won't be parsed. ```twig {% verbatim %} {% for user in users %} {{ user.name }} - {% endfor %}} + {% endfor %} {% endverbatim %} -``` \ No newline at end of file +``` +
+## Inline Verbatim Text + +For inline verbatim text, a string literal can be used. For example, if you need to include **{{** in the output of a template, you can use `{{ "{{" }}` in string literal in the Pebble template + +This would be useful if you are using Pebble to generate Angular HTML component template files: + +```javascript +{{ "{{" }}school.name{{ "}}" }} +``` + +would produce the following template output: + +```javascript +{{school.name}} +``` From 7c83a70507cacb165d4ee5a2eb3393edbe881620 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Sep 2019 10:13:54 -0400 Subject: [PATCH 2/7] Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way. --- pebble/pom.xml | 14 ++ .../template/tests/PebbleTestContext.java | 154 ++++++++++++++++++ ...eSpaceControlWithNewLineTrimmingTests.java | 102 ++++++++++++ .../template/tests/input/PebbleTestItem.java | 46 ++++++ .../tests/input/PebbleTestItemType.java | 5 + pebble/src/test/resources/logback-test.xml | 3 + .../ForLoopWithNestedIfStatement.peb | 13 ++ .../ForLoopWithNestedIfStatement.txt | 11 ++ .../ForLoopWithNestedIfStatementAndMacro.peb | 17 ++ .../ForLoopWithNestedIfStatementAndMacro.txt | 12 ++ ...LoopWithNestedIfStatementThatIsSkipped.peb | 9 + ...LoopWithNestedIfStatementThatIsSkipped.txt | 7 + 12 files changed, 393 insertions(+) create mode 100644 pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java create mode 100644 pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java create mode 100644 pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItem.java create mode 100644 pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItemType.java create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.peb create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb create mode 100644 pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt diff --git a/pebble/pom.xml b/pebble/pom.xml index f3a0f135e..a9d0b8960 100644 --- a/pebble/pom.xml +++ b/pebble/pom.xml @@ -66,6 +66,20 @@ + + + org.assertj + assertj-core + 3.13.2 + test + + + + commons-io + commons-io + 2.6 + test + diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java new file mode 100644 index 000000000..483d7191f --- /dev/null +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java @@ -0,0 +1,154 @@ +package com.mitchellbosecke.pebble.template.tests; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.mitchellbosecke.pebble.PebbleEngine; +import com.mitchellbosecke.pebble.loader.StringLoader; +import com.mitchellbosecke.pebble.template.PebbleTemplate; + +/** + * Used by Pebble Template Tests to simply the test code and therefore + * make it easier to understand what is tested by each test. + * + * A separate instance of this class should be instantiated for each + * template test, i.e. for each instance of a template. + * + * @author nathanward + */ +public class PebbleTestContext { + + private final Logger logger = LoggerFactory.getLogger(PebbleTestContext.class); + + /** + * The path relative to the project root directory where template files and + * expected output files are stored for test purposes. + */ + private String testFileBasePath = "src/test/resources/template-tests"; + + /** + * The Pebble template context to be used as input for a Pebble Template. + */ + private Map templateContext = null; + + /** + * Whether or not the Pebble Engine instantiated will + * enable New Line Trimming on the Builder when this class instantiates + * a Pebble Engine instance. Defaults to true. + */ + private boolean newLineTrimming = true; + + /** + * Initialize the Pebble Template Context. + */ + public PebbleTestContext() { + this.templateContext = new HashMap(); + } + + public void setNewLineTrimming(boolean b) { + this.newLineTrimming = b; + } + + /** + * Put an object into the Pebble template context to be used as input for + * when the template is executed. One or more items can be put into the template + * context. + * + * @param name Template input/parameter name (i.e. key) for use within the template + * @param value The object that will be referred to by the given name in the template + */ + public void setTemplateInput(String name, Object value) { + this.templateContext.put(name, value); + } + + /** + * Load the specified template file and execute the template using a + * Pebble Engine using the default Builder (classpath and file builder). + * + * @param templateFilename The template filename relative to the Test File Base Path + * + * @return The output of the template as a string. + * + * @throws IOException Thrown if the template file is not found. + */ + public String executeTemplateFromFile(String templateFilename) throws IOException { + PebbleEngine pebbleEngine = new PebbleEngine.Builder() + .newLineTrimming(this.newLineTrimming).strictVariables(true).build(); + return this.executeTemplateFromFile(templateFilename, pebbleEngine); + } + + /** + * Execute a template given a template file and a Pebble Engine instance. + * + * @param templateFilename The template filename relative to the Test File Base Path + * @param pebbleEngine + * @return + * @throws IOException + */ + public String executeTemplateFromFile(String templateFilename, PebbleEngine pebbleEngine) throws IOException { + Path path = Paths.get(this.testFileBasePath, templateFilename); + logger.debug("Executing template file: {}", path.toString()); + return this.executeTemplate(path.toAbsolutePath().toString(), pebbleEngine); + } + + /** + * Load the specified template file and execute the template using a + * Pebble Engine using the default Builder (classpath and file builder). + * + * @param templateString The template content as a string + * + * @return The output of the template as a string. + * + * @throws IOException Thrown if the template file is not found. + */ + public String executeTemplateFromString(String templateString) throws IOException { + PebbleEngine pebbleEngine = new PebbleEngine.Builder().loader(new StringLoader()) + .newLineTrimming(this.newLineTrimming).build(); + return this.executeTemplate(templateString, pebbleEngine); + } + + /** + * Load the specified template file and execute the template using the template input + * that has previously been specified using the setTemplateInput() method. + * + * @param templateFilename The template filename relative to the Test File Base Path + * @param pebbleEngine The Pebble Engine to be used to execute the template + * @return The output of the template as a string. + * + * @throws IOException Thrown if the template file is not found. + */ + public String executeTemplate(String templateName, PebbleEngine pebbleEngine) throws IOException { + PebbleTemplate template = pebbleEngine.getTemplate(templateName); + Writer writer = new StringWriter(); + template.evaluate(writer, this.templateContext); + String templateOutput = writer.toString(); + logger.debug("Template Output: {}", templateOutput); + return templateOutput; + } + + /** + * Get the Expected Output content for the given filename so that the + * base path to the expected template output file does not have to be + * specified in the actual test code. + * + * @param filename The name of the file that contains the expected template output. + * @return The content of the expected template output file as a string. + * @throws IOException Thrown if the file by the given name is not found. + */ + public String getExpectedOutput(String filename) throws IOException { + Path path = Paths.get(this.testFileBasePath, filename); + logger.debug("Expected template output file: {}", path.toAbsolutePath()); + String expectedOutput = FileUtils.readFileToString(path.toFile(), "UTF-8"); + return expectedOutput; + } + +} diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java new file mode 100644 index 000000000..1175418c8 --- /dev/null +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java @@ -0,0 +1,102 @@ +/* + * This file is part of Pebble. + * + * Copyright (c) 2014 by Mitchell Bösecke + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +package com.mitchellbosecke.pebble.template.tests; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import com.mitchellbosecke.pebble.error.PebbleException; +import com.mitchellbosecke.pebble.template.tests.input.PebbleTestItem; +import com.mitchellbosecke.pebble.template.tests.input.PebbleTestItemType; + +/** + * Tests of whitespace control when New Line Trimming is enabled. + * This mainly affects vertical spacing, i.e. the control of blank lines. + * With New Line Trimming enabled, Pebble control statements on a line + * by themselves products a blank line in the output unless + * the Whitespace Control Modifier is used before and/or after the + * control statement, i.e. the dash character, e.g. `{% if item.itemType equals "ITEM_TYPE1" -%}`. + * + * However, it can be difficult to get the blank lines to come out as expected + * in the case that nested control structures are used. + * + * @author nathanward + */ +public class WhiteSpaceControlWithNewLineTrimmingTests { + + /** + * All tests in this class use this list of objects as the input to the template. + */ + private List listOfObjects = new ArrayList(); + + /** + * Used by each test and initialized before each test to simplify the + * test execution, which helps make the purpose of each test clear. + */ + private PebbleTestContext pebbleTestContext = null; + + @Before + public void setup() { + listOfObjects.add(new PebbleTestItem("Item 1", PebbleTestItemType.ITEM_TYPE1)); + listOfObjects.add(new PebbleTestItem("Item 2", PebbleTestItemType.ITEM_TYPE2)); + listOfObjects.add(new PebbleTestItem("Item 3", PebbleTestItemType.ITEM_TYPE3, true)); + listOfObjects.add(new PebbleTestItem("Item 4", PebbleTestItemType.ITEM_TYPE4)); + + pebbleTestContext = new PebbleTestContext(); + pebbleTestContext.setNewLineTrimming(false); + pebbleTestContext.setTemplateInput("items", listOfObjects); + } + + /** + * Test the whitespace control for a template that has a for loop with a nested + * if statement where some text is output for each item in the list. + * + * @throws PebbleException + * @throws IOException + */ + @Test + public void testForLoopWithNestedIfStatement() throws PebbleException, IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatement.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatement.txt")); + } + + /** + * Test the whitespace control for a template that has a for loop with a nested + * if statement that uses a macro and the macro also has an if statement. + * + * @throws PebbleException + * @throws IOException + */ + @Test + public void testForLoopWithNestedIfStatementAndMacro() throws PebbleException, IOException {; + String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatementAndMacro.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementAndMacro.txt")); + } + + /** + * Test the whitespace control for a template that has a for loop with a nested + * if statement that skips some of the items in the for loop. + * + * @throws PebbleException + * @throws IOException + */ + @Ignore("Fails due to extra blank line in the case that the if condition in the template is is not met") + @Test + public void testForLoopWithNestedIfStatementThatIsSkipped() throws IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatementThatIsSkipped.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementThatIsSkipped.txt")); + } +} diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItem.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItem.java new file mode 100644 index 000000000..3ff602c07 --- /dev/null +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItem.java @@ -0,0 +1,46 @@ +package com.mitchellbosecke.pebble.template.tests.input; + +public class PebbleTestItem { + + private String name; + + private PebbleTestItemType itemType; + + private boolean hasPrefix; + + public PebbleTestItem(String name, PebbleTestItemType itemType1) { + this.name = name; + this.itemType = itemType1; + } + + public PebbleTestItem(String name, PebbleTestItemType itemType1, boolean hasPrefix) { + this.name = name; + this.itemType = itemType1; + this.hasPrefix = hasPrefix; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public PebbleTestItemType getItemType() { + return itemType; + } + + public void setItemType(PebbleTestItemType pebbleTestItemType) { + this.itemType = pebbleTestItemType; + } + + public boolean isHasPrefix() { + return hasPrefix; + } + + public void setHasPrefix(boolean hasPrefix) { + this.hasPrefix = hasPrefix; + } + +} diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItemType.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItemType.java new file mode 100644 index 000000000..c25139834 --- /dev/null +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/input/PebbleTestItemType.java @@ -0,0 +1,5 @@ +package com.mitchellbosecke.pebble.template.tests.input; + +public enum PebbleTestItemType { + ITEM_TYPE1, ITEM_TYPE2, ITEM_TYPE3, ITEM_TYPE4 +} diff --git a/pebble/src/test/resources/logback-test.xml b/pebble/src/test/resources/logback-test.xml index 6237f0822..834d8404c 100644 --- a/pebble/src/test/resources/logback-test.xml +++ b/pebble/src/test/resources/logback-test.xml @@ -9,4 +9,7 @@ + + + \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb new file mode 100644 index 000000000..e70657a08 --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb @@ -0,0 +1,13 @@ +text before for loop followed by blank line +{% for item in items %} +{% if item.itemType equals "ITEM_TYPE1" -%} +Item 1 +{% elseif item.itemType equals "ITEM_TYPE2" -%} +Item 2 +{% elseif item.itemType equals "ITEM_TYPE3" -%} +Item 3 +{% elseif item.itemType equals "ITEM_TYPE4" -%} +Item 4 +{% endif -%} +{% endfor %} +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt new file mode 100644 index 000000000..3d36e6f43 --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt @@ -0,0 +1,11 @@ +text before for loop followed by blank line + +Item 1 + +Item 2 + +Item 3 + +Item 4 + +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.peb b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.peb new file mode 100644 index 000000000..1e1b49a79 --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.peb @@ -0,0 +1,17 @@ +text before for loop followed by blank line +{% for item in items %} +{% if item.itemType equals "ITEM_TYPE1" -%} +{{ item.name }} +{% else -%} +{{ itemStatement(item) }} +{% endif -%} +{% endfor %} +text after for loop preceded by blank line + + +{%- macro itemStatement(item) -%} +{%- if item.hasPrefix == true -%} +Prefix Text +{% endif -%} +{{ item.name }} +{%- endmacro -%} \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt new file mode 100644 index 000000000..b365ddeaa --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt @@ -0,0 +1,12 @@ +text before for loop followed by blank line + +Item 1 + +Item 2 + +Prefix Text +Item 3 + +Item 4 + +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb new file mode 100644 index 000000000..ae6343d8b --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb @@ -0,0 +1,9 @@ +text before for loop followed by blank line +{% for item in items %} +{% if item.itemType equals "ITEM_TYPE1" -%} +Item 1 +{% elseif item.itemType equals "ITEM_TYPE2" -%} +Item 2 +{% endif -%} +{% endfor %} +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt new file mode 100644 index 000000000..3b1471188 --- /dev/null +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt @@ -0,0 +1,7 @@ +text before for loop followed by blank line + +Item 1 + +Item 2 + +text after for loop preceded by blank line \ No newline at end of file From 1a25dc2a71e15bdae00f46b6bf28d08fa62b9522 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Sep 2019 10:17:05 -0400 Subject: [PATCH 3/7] Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear. --- .../pebble/NewlineTrimmingTest.java | 14 ++- .../pebble/WhitespaceControlTest.java | 93 +++++++++++++++---- 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/NewlineTrimmingTest.java b/pebble/src/test/java/com/mitchellbosecke/pebble/NewlineTrimmingTest.java index e2c2b05c1..145dbb851 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/NewlineTrimmingTest.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/NewlineTrimmingTest.java @@ -61,8 +61,13 @@ public void testPrintForceToTrue() throws PebbleException, IOException { assertEquals("val1val2", writer.toString()); } + /** + * Given that Newline Trimming is disabled, + * a template that contains one newline character with text on each line + * should output one newline character. + */ @Test - public void testPrintSetToFalse() throws PebbleException, IOException { + public void testNewLineIncludedWhen_NewLineTrimmingIsFalse() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .newLineTrimming(false) @@ -100,8 +105,13 @@ public void testPrintDefaultTwoNewlines() throws PebbleException, IOException { assertEquals("val1\nval2", writer.toString()); } + /** + * Given that Newline Trimming is disabled, + * a template that contains one or more consecutive newline characters + * should output one newline character. + */ @Test - public void testPrintSetToFalseTwoNewlines() throws PebbleException, IOException { + public void testOneNewLineWhen_NewLineTrimmingFalseAndConsecutiveNewLinesInTemplate() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .newLineTrimming(false) diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/WhitespaceControlTest.java b/pebble/src/test/java/com/mitchellbosecke/pebble/WhitespaceControlTest.java index 64ff0710f..c61a0d50e 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/WhitespaceControlTest.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/WhitespaceControlTest.java @@ -10,38 +10,68 @@ import static org.junit.Assert.assertEquals; -import com.mitchellbosecke.pebble.error.PebbleException; -import com.mitchellbosecke.pebble.loader.StringLoader; -import com.mitchellbosecke.pebble.template.PebbleTemplate; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; + import org.junit.Test; +import com.mitchellbosecke.pebble.error.PebbleException; +import com.mitchellbosecke.pebble.loader.StringLoader; +import com.mitchellbosecke.pebble.template.PebbleTemplate; + public class WhitespaceControlTest { + /** + * A windows newline character (i.e. \n\r) in a template should be recognized + * and output as as a Windows newline character. The Windows newline character + * should not be converted to a Unix newline character (i.e. \n). + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testStandardizationOfNewlineCharacters() throws PebbleException, IOException { + public void testWindowsNewlineCharacter() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); - // windows PebbleTemplate windowsTemplate = pebble.getTemplate("\r\n"); Writer windowsWriter = new StringWriter(); windowsTemplate.evaluate(windowsWriter); assertEquals("\r\n", windowsWriter.toString()); + } + + /** + * A Unix newline character (i.e. \n\r) in a template should be recognized + * and output as as a Unix newline character. The Unix newline character + * should not be converted to a Windows newline character (i.e. \r\n). + * + * @throws PebbleException + * @throws IOException + */ + @Test + public void testUnixNewlineCharacter() throws PebbleException, IOException { + PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) + .strictVariables(true).build(); - // unix PebbleTemplate unixTemplate = pebble.getTemplate("\n"); Writer unixWriter = new StringWriter(); unixTemplate.evaluate(unixWriter); assertEquals("\n", unixWriter.toString()); } + /** + * A leading Whitespace Control Modifier in an expression delimiter (i.e. Pebble variable reference) + * should remove whitespace before the variable reference on the same line up to any + * surrounding text, i.e. a print delimiter. + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testLeadingWhitespaceTrimWithPrintDelimiter() throws PebbleException, IOException { + public void testLeadingWhitespaceControlModifier() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); @@ -54,36 +84,60 @@ public void testLeadingWhitespaceTrimWithPrintDelimiter() throws PebbleException assertEquals("
  • bar
  • ", writer.toString()); } + /** + * A trailing Whitespace Control Modifier in an expression delimiter (i.e. Pebble variable reference) + * should remove whitespace after the variable reference on the same line up to any + * surrounding text. + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testLeadingWhitespaceTrimWithoutOutsideText() throws PebbleException, IOException { + public void testTrailingWhitespaceControlModifier() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); - PebbleTemplate template = pebble.getTemplate("{{- foo -}}"); + PebbleTemplate template = pebble.getTemplate("
  • {{ foo -}}
  • "); Writer writer = new StringWriter(); Map context = new HashMap<>(); context.put("foo", "bar"); template.evaluate(writer, context); - assertEquals("bar", writer.toString()); + assertEquals("
  • bar
  • ", writer.toString()); } - + + /** + * A Whitespace Control Modifier in an expression delimiter (i.e. Pebble variable reference) + * should not have any effect if there is no whitespace immediately before or after the + * variable reference. + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testTrailingWhitespaceTrimWithPrintDelimiter() throws PebbleException, IOException { + public void testLeadingWhitespaceTrimWithoutOutsideText() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); - PebbleTemplate template = pebble.getTemplate("
  • {{ foo -}}
  • "); + PebbleTemplate template = pebble.getTemplate("{{- foo -}}"); Writer writer = new StringWriter(); Map context = new HashMap<>(); context.put("foo", "bar"); template.evaluate(writer, context); - assertEquals("
  • bar
  • ", writer.toString()); + assertEquals("bar", writer.toString()); } + /** + * A leading and trailing Whitespace Control Modifiers in an expression delimiter + * (i.e. Pebble variable reference) should remove whitespace before and after + * the variable reference on the same line up to any surrounding text. + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testWhitespaceTrimInPresenceOfMultipleTags() throws PebbleException, IOException { + public void testLeadingAndTrailingWhitespaceControlModifier() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); @@ -97,8 +151,15 @@ public void testWhitespaceTrimInPresenceOfMultipleTags() throws PebbleException, assertEquals("bar
  • bar
  • bar", writer.toString()); } + /** + * Newline characters immediately before or after a Whitespace Control Modifier + * should be removed. + * + * @throws PebbleException + * @throws IOException + */ @Test - public void testWhitespaceTrimRemovesNewlines() throws PebbleException, IOException { + public void testWhitespaceControlModifierRemovesNewlines() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(true).build(); From 43aa3fda63bab372c4569071dfffacba53913c70 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Fri, 13 Sep 2019 05:43:33 -0600 Subject: [PATCH 4/7] Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test --- .../ForLoopWithNestedIfStatementThatIsSkipped.peb | 6 +++++- .../ForLoopWithNestedIfStatementThatIsSkipped.txt | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb index ae6343d8b..6782ce272 100644 --- a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb @@ -4,6 +4,10 @@ text before for loop followed by blank line Item 1 {% elseif item.itemType equals "ITEM_TYPE2" -%} Item 2 -{% endif -%} +{% elseif item.itemType equals "ITEM_TYPE3" -%} +Item 3 +{% elseif item.itemType equals "ITEM_TYPE4" -%} +Item 4 +{%- endif -%} {% endfor %} text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt index 3b1471188..3d36e6f43 100644 --- a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt @@ -4,4 +4,8 @@ Item 1 Item 2 +Item 3 + +Item 4 + text after for loop preceded by blank line \ No newline at end of file From 3e5c798d60007899e167b1e8d7b460676eec8f1d Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Fri, 13 Sep 2019 08:30:48 -0600 Subject: [PATCH 5/7] Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if. --- ...eSpaceControlWithNewLineTrimmingTests.java | 25 +++++++++---------- ...dIfStatementWithThreeElseIfStatements.peb} | 0 ...dIfStatementWithThreeElseIfStatements.txt} | 0 ...tedIfStatementWithTwoElseIfStatements.peb} | 0 ...tedIfStatementWithTwoElseIfStatements.txt} | 0 5 files changed, 12 insertions(+), 13 deletions(-) rename pebble/src/test/resources/template-tests/{ForLoopWithNestedIfStatement.peb => NestedIfStatementWithThreeElseIfStatements.peb} (100%) rename pebble/src/test/resources/template-tests/{ForLoopWithNestedIfStatement.txt => NestedIfStatementWithThreeElseIfStatements.txt} (100%) rename pebble/src/test/resources/template-tests/{ForLoopWithNestedIfStatementThatIsSkipped.peb => NestedIfStatementWithTwoElseIfStatements.peb} (100%) rename pebble/src/test/resources/template-tests/{ForLoopWithNestedIfStatementThatIsSkipped.txt => NestedIfStatementWithTwoElseIfStatements.txt} (100%) diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java index 1175418c8..f37afbc72 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java @@ -62,28 +62,28 @@ public void setup() { /** * Test the whitespace control for a template that has a for loop with a nested - * if statement where some text is output for each item in the list. + * if statement that uses a macro and the macro also has an if statement. * * @throws PebbleException * @throws IOException */ @Test - public void testForLoopWithNestedIfStatement() throws PebbleException, IOException { - String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatement.peb"); - assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatement.txt")); + public void testForLoopWithNestedIfStatementAndMacro() throws PebbleException, IOException {; + String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatementAndMacro.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementAndMacro.txt")); } - + /** * Test the whitespace control for a template that has a for loop with a nested - * if statement that uses a macro and the macro also has an if statement. + * if statement where some text is output for each item in the list. * * @throws PebbleException * @throws IOException */ @Test - public void testForLoopWithNestedIfStatementAndMacro() throws PebbleException, IOException {; - String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatementAndMacro.peb"); - assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementAndMacro.txt")); + public void testNestedIfStatementWithThreeElseIfStatements() throws PebbleException, IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithThreeElseIfStatements.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithThreeElseIfStatements.txt")); } /** @@ -93,10 +93,9 @@ public void testForLoopWithNestedIfStatement() throws PebbleException, IOExcepti * @throws PebbleException * @throws IOException */ - @Ignore("Fails due to extra blank line in the case that the if condition in the template is is not met") @Test - public void testForLoopWithNestedIfStatementThatIsSkipped() throws IOException { - String templateOutput = pebbleTestContext.executeTemplateFromFile("ForLoopWithNestedIfStatementThatIsSkipped.peb"); - assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementThatIsSkipped.txt")); + public void testNestedIfStatementWithTwioElseIfStatements() throws IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithThreeElseIfStatements.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithThreeElseIfStatements.txt")); } } diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb b/pebble/src/test/resources/template-tests/NestedIfStatementWithThreeElseIfStatements.peb similarity index 100% rename from pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.peb rename to pebble/src/test/resources/template-tests/NestedIfStatementWithThreeElseIfStatements.peb diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt b/pebble/src/test/resources/template-tests/NestedIfStatementWithThreeElseIfStatements.txt similarity index 100% rename from pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatement.txt rename to pebble/src/test/resources/template-tests/NestedIfStatementWithThreeElseIfStatements.txt diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb similarity index 100% rename from pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.peb rename to pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt similarity index 100% rename from pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementThatIsSkipped.txt rename to pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt From 9fd732cdb3e97f016989fc4dc44e439400cc7004 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Fri, 13 Sep 2019 08:39:05 -0600 Subject: [PATCH 6/7] Added test of Nested If with One ifelse statement --- ...eSpaceControlWithNewLineTrimmingTests.java | 21 +++++++++++++++---- ...stedIfStatementWithOneElseIfStatements.peb | 9 ++++++++ ...stedIfStatementWithOneElseIfStatements.txt | 7 +++++++ ...stedIfStatementWithTwoElseIfStatements.peb | 2 -- ...stedIfStatementWithTwoElseIfStatements.txt | 2 -- 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.peb create mode 100644 pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.txt diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java index f37afbc72..c4e8c8b2e 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java @@ -81,9 +81,22 @@ public void setup() { * @throws IOException */ @Test - public void testNestedIfStatementWithThreeElseIfStatements() throws PebbleException, IOException { - String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithThreeElseIfStatements.peb"); - assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithThreeElseIfStatements.txt")); + public void testNestedIfStatementWithOneElseIfStatements() throws PebbleException, IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithOneElseIfStatements.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithOneElseIfStatements.txt")); + } + + /** + * Test the whitespace control for a template that has a for loop with a nested + * if statement where some text is output for each item in the list. + * + * @throws PebbleException + * @throws IOException + */ + @Test + public void testNestedIfStatementWithTwoElseIfStatements() throws PebbleException, IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithTwoElseIfStatements.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithTwoElseIfStatements.txt")); } /** @@ -94,7 +107,7 @@ public void testNestedIfStatementWithThreeElseIfStatements() throws PebbleExcept * @throws IOException */ @Test - public void testNestedIfStatementWithTwioElseIfStatements() throws IOException { + public void testNestedIfStatementWithThreeElseIfStatements() throws IOException { String templateOutput = pebbleTestContext.executeTemplateFromFile("NestedIfStatementWithThreeElseIfStatements.peb"); assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("NestedIfStatementWithThreeElseIfStatements.txt")); } diff --git a/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.peb b/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.peb new file mode 100644 index 000000000..e724e10bb --- /dev/null +++ b/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.peb @@ -0,0 +1,9 @@ +text before for loop followed by blank line +{% for item in items %} +{% if item.itemType equals "ITEM_TYPE1" -%} +Item 1 +{% elseif item.itemType equals "ITEM_TYPE2" -%} +Item 2 +{%- endif -%} +{% endfor -%} +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.txt b/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.txt new file mode 100644 index 000000000..3b1471188 --- /dev/null +++ b/pebble/src/test/resources/template-tests/NestedIfStatementWithOneElseIfStatements.txt @@ -0,0 +1,7 @@ +text before for loop followed by blank line + +Item 1 + +Item 2 + +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb index 6782ce272..0b7e8c9ae 100644 --- a/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb +++ b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.peb @@ -6,8 +6,6 @@ Item 1 Item 2 {% elseif item.itemType equals "ITEM_TYPE3" -%} Item 3 -{% elseif item.itemType equals "ITEM_TYPE4" -%} -Item 4 {%- endif -%} {% endfor %} text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt index 3d36e6f43..1be3f0c5d 100644 --- a/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt +++ b/pebble/src/test/resources/template-tests/NestedIfStatementWithTwoElseIfStatements.txt @@ -6,6 +6,4 @@ Item 2 Item 3 -Item 4 - text after for loop preceded by blank line \ No newline at end of file From b1657bc219406345093788448f4e720f08f3ca6d Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 23 Sep 2019 07:54:34 -0400 Subject: [PATCH 7/7] Improved and added additional whitespace control tests. --- .../template/tests/PebbleTestContext.java | 2 +- ...eSpaceControlWithNewLineTrimmingTests.java | 26 +++++++++++++++---- .../DoubleNestedIfStatement.peb | 16 ++++++++++++ .../DoubleNestedIfStatement.txt | 12 +++++++++ .../ForLoopWithNestedIfStatementAndMacro.txt | 2 +- 5 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 pebble/src/test/resources/template-tests/DoubleNestedIfStatement.peb create mode 100644 pebble/src/test/resources/template-tests/DoubleNestedIfStatement.txt diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java index 483d7191f..98a385aa2 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/PebbleTestContext.java @@ -55,7 +55,7 @@ public PebbleTestContext() { } public void setNewLineTrimming(boolean b) { - this.newLineTrimming = b; + this.newLineTrimming = b; } /** diff --git a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java index c4e8c8b2e..863a37f05 100644 --- a/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java +++ b/pebble/src/test/java/com/mitchellbosecke/pebble/template/tests/WhiteSpaceControlWithNewLineTrimmingTests.java @@ -40,7 +40,7 @@ public class WhiteSpaceControlWithNewLineTrimmingTests { /** * All tests in this class use this list of objects as the input to the template. */ - private List listOfObjects = new ArrayList(); + private List listOfObjects = null; /** * Used by each test and initialized before each test to simplify the @@ -50,13 +50,15 @@ public class WhiteSpaceControlWithNewLineTrimmingTests { @Before public void setup() { + pebbleTestContext = new PebbleTestContext(); + pebbleTestContext.setNewLineTrimming(false); + + listOfObjects = new ArrayList(); listOfObjects.add(new PebbleTestItem("Item 1", PebbleTestItemType.ITEM_TYPE1)); listOfObjects.add(new PebbleTestItem("Item 2", PebbleTestItemType.ITEM_TYPE2)); - listOfObjects.add(new PebbleTestItem("Item 3", PebbleTestItemType.ITEM_TYPE3, true)); - listOfObjects.add(new PebbleTestItem("Item 4", PebbleTestItemType.ITEM_TYPE4)); + listOfObjects.add(new PebbleTestItem("Item 3", PebbleTestItemType.ITEM_TYPE3)); + listOfObjects.add(new PebbleTestItem("Item 4", PebbleTestItemType.ITEM_TYPE4, true)); - pebbleTestContext = new PebbleTestContext(); - pebbleTestContext.setNewLineTrimming(false); pebbleTestContext.setTemplateInput("items", listOfObjects); } @@ -73,6 +75,20 @@ public void setup() { assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("ForLoopWithNestedIfStatementAndMacro.txt")); } + /** + * Test the whitespace control for a template that has a for loop with a nested + * if statement that uses a macro and the macro also has an if statement. + * + * @throws PebbleException + * @throws IOException + */ + // TODO not sure why the white space controls work the way that it does for this case. + @Test + public void testDoubleNestedIfStatement() throws PebbleException, IOException { + String templateOutput = pebbleTestContext.executeTemplateFromFile("DoubleNestedIfStatement.peb"); + assertThat(templateOutput).contains(pebbleTestContext.getExpectedOutput("DoubleNestedIfStatement.txt")); + } + /** * Test the whitespace control for a template that has a for loop with a nested * if statement where some text is output for each item in the list. diff --git a/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.peb b/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.peb new file mode 100644 index 000000000..f72943f47 --- /dev/null +++ b/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.peb @@ -0,0 +1,16 @@ +text before for loop followed by blank line +{% for item in items %} +{% if item.itemType equals "ITEM_TYPE1" -%} +Item 1 +{% elseif item.itemType equals "ITEM_TYPE2" -%} +Item 2 +{% elseif item.itemType equals "ITEM_TYPE3" -%} +Item 3 +{% elseif item.itemType equals "ITEM_TYPE4" -%} +{% if item.hasPrefix -%} +Item Prefix +{% endif -%} +Item 4 +{% endif -%} +{% endfor %} +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.txt b/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.txt new file mode 100644 index 000000000..1dd1c80de --- /dev/null +++ b/pebble/src/test/resources/template-tests/DoubleNestedIfStatement.txt @@ -0,0 +1,12 @@ +text before for loop followed by blank line + +Item 1 + +Item 2 + +Item 3 + +Item Prefix +Item 4 + +text after for loop preceded by blank line \ No newline at end of file diff --git a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt index b365ddeaa..d6ba7b3d9 100644 --- a/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt +++ b/pebble/src/test/resources/template-tests/ForLoopWithNestedIfStatementAndMacro.txt @@ -4,9 +4,9 @@ Item 1 Item 2 -Prefix Text Item 3 +Prefix Text Item 4 text after for loop preceded by blank line \ No newline at end of file