summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/00_syntax/12_block_whitespace_control
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2021-03-19 16:54:55 +0100
committerJo-Philipp Wich <jo@mein.io>2021-04-23 00:42:30 +0200
commit2b59097c3f61fa901e91ac4cea48940760439578 (patch)
tree958d739a78f959dfcd55b3d76e6e970ca53fa1c6 /tests/custom/00_syntax/12_block_whitespace_control
parent80393611fb6634abcc0da1dee2da7c4418dbde8d (diff)
tests: create custom tests from current tests cases
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'tests/custom/00_syntax/12_block_whitespace_control')
-rw-r--r--tests/custom/00_syntax/12_block_whitespace_control47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/custom/00_syntax/12_block_whitespace_control b/tests/custom/00_syntax/12_block_whitespace_control
new file mode 100644
index 0000000..911171c
--- /dev/null
+++ b/tests/custom/00_syntax/12_block_whitespace_control
@@ -0,0 +1,47 @@
+By default, whitespace before a block start tag or after a block end tag
+is retained. By suffixing the start tag or prefixing the end tag with a
+dash, the leading or trailing whitespace is trimmed respectively.
+
+-- Expect stdout --
+Whitespace control applies to all block types:
+Comment before: | |, after: | |, both: ||
+Statement before: |test |, after: | test|, both: |test|
+Expression before: |test |, after: | test|, both: |test|
+
+By default whitespace around a block is retained.
+Leading whitespace can be trimmed like this.
+The same applies to trailing whitespace.
+It is also possible to trim bothleading and trailingwhitespace.
+
+Stripping works across multiple lines as well:test
+
+Likewise, stripping over multiple lines of trailing whitespace works as
+expected too.This is after the block.
+-- End --
+
+-- Testcase --
+Whitespace control applies to all block types:
+Comment before: | {#- test #} |, after: | {#- test #} |, both: | {#- test -#} |
+Statement before: | {%- print("test") %} |, after: | {%+ print("test") -%} |, both: | {%- print("test") -%} |
+Expression before: | {{- "test" }} |, after: | {{ "test" -}} |, both: | {{- "test" -}} |
+
+By default whitespace {{ "around a block" }} is retained.
+Leading whitespace can be trimmed {#- note the leading dash #} like this.
+The same applies to {# note the trailing dash -#} trailing whitespace.
+It is also possible to trim both {{- "leading and trailing" -}} whitespace.
+
+Stripping works across multiple lines as well:
+
+{%-
+ /* The word "test" will be printed after "well:" above */
+ print("test")
+%}
+
+
+Likewise, stripping over multiple lines of trailing whitespace works as
+expected too.
+
+{#- Any whitespace after "expected too." and before "This is after the block" will be trimmed. -#}
+
+This is after the block.
+-- End --