From 031615ac866cc3c8f1900dd4b4aae2106ad31230 Mon Sep 17 00:00:00 2001 From: ipknHama Date: Thu, 7 Aug 2014 01:18:33 +0900 Subject: source resturcturing + CMake --- tests/template/delimiters.yml | 158 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 tests/template/delimiters.yml (limited to 'tests/template/delimiters.yml') diff --git a/tests/template/delimiters.yml b/tests/template/delimiters.yml new file mode 100644 index 0000000..ce80b17 --- /dev/null +++ b/tests/template/delimiters.yml @@ -0,0 +1,158 @@ +overview: | + Set Delimiter tags are used to change the tag delimiters for all content + following the tag in the current compilation unit. + + The tag's content MUST be any two non-whitespace sequences (separated by + whitespace) EXCEPT an equals sign ('=') followed by the current closing + delimiter. + + Set Delimiter tags SHOULD be treated as standalone when appropriate. +tests: + - name: Pair Behavior + desc: The equals sign (used on both sides) should permit delimiter changes. + data: { text: 'Hey!' } + template: '{{=<% %>=}}(<%text%>)' + expected: '(Hey!)' + + - name: Special Characters + desc: Characters with special meaning regexen should be valid delimiters. + data: { text: 'It worked!' } + template: '({{=[ ]=}}[text])' + expected: '(It worked!)' + + - name: Sections + desc: Delimiters set outside sections should persist. + data: { section: true, data: 'I got interpolated.' } + template: | + [ + {{#section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |#section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Inverted Sections + desc: Delimiters set outside inverted sections should persist. + data: { section: false, data: 'I got interpolated.' } + template: | + [ + {{^section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |^section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Partial Inheritence + desc: Delimiters set in a parent template should not affect a partial. + data: { value: 'yes' } + partials: + include: '.{{value}}.' + template: | + [ {{>include}} ] + {{= | | =}} + [ |>include| ] + expected: | + [ .yes. ] + [ .yes. ] + + - name: Post-Partial Behavior + desc: Delimiters set in a partial should not affect the parent template. + data: { value: 'yes' } + partials: + include: '.{{value}}. {{= | | =}} .|value|.' + template: | + [ {{>include}} ] + [ .{{value}}. .|value|. ] + expected: | + [ .yes. .yes. ] + [ .yes. .|value|. ] + + # Whitespace Sensitivity + + - name: Surrounding Whitespace + desc: Surrounding whitespace should be left untouched. + data: { } + template: '| {{=@ @=}} |' + expected: '| |' + + - name: Outlying Whitespace (Inline) + desc: Whitespace should be left untouched. + data: { } + template: " | {{=@ @=}}\n" + expected: " | \n" + + - name: Standalone Tag + desc: Standalone lines should be removed from the template. + data: { } + template: | + Begin. + {{=@ @=}} + End. + expected: | + Begin. + End. + + - name: Indented Standalone Tag + desc: Indented standalone lines should be removed from the template. + data: { } + template: | + Begin. + {{=@ @=}} + End. + expected: | + Begin. + End. + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { } + template: "|\r\n{{= @ @ =}}\r\n|" + expected: "|\r\n|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { } + template: " {{=@ @=}}\n=" + expected: "=" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { } + template: "=\n {{=@ @=}}" + expected: "=\n" + + # Whitespace Insensitivity + + - name: Pair with Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { } + template: '|{{= @ @ =}}|' + expected: '||' -- cgit v1.2.3-54-g00ecf