OLD | NEW |
(Empty) | |
| 1 overview: | |
| 2 Comment tags represent content that should never appear in the resulting |
| 3 output. |
| 4 |
| 5 The tag's content may contain any substring (including newlines) EXCEPT the |
| 6 closing delimiter. |
| 7 |
| 8 Comment tags SHOULD be treated as standalone when appropriate. |
| 9 tests: |
| 10 - name: Inline |
| 11 desc: Comment blocks should be removed from the template. |
| 12 data: { } |
| 13 template: '12345{{! Comment Block! }}67890' |
| 14 expected: '1234567890' |
| 15 |
| 16 - name: Multiline |
| 17 desc: Multiline comments should be permitted. |
| 18 data: { } |
| 19 template: | |
| 20 12345{{! |
| 21 This is a |
| 22 multi-line comment... |
| 23 }}67890 |
| 24 expected: | |
| 25 1234567890 |
| 26 |
| 27 - name: Standalone |
| 28 desc: All standalone comment lines should be removed. |
| 29 data: { } |
| 30 template: | |
| 31 Begin. |
| 32 {{! Comment Block! }} |
| 33 End. |
| 34 expected: | |
| 35 Begin. |
| 36 End. |
| 37 |
| 38 - name: Indented Standalone |
| 39 desc: All standalone comment lines should be removed. |
| 40 data: { } |
| 41 template: | |
| 42 Begin. |
| 43 {{! Indented Comment Block! }} |
| 44 End. |
| 45 expected: | |
| 46 Begin. |
| 47 End. |
| 48 |
| 49 - name: Standalone Line Endings |
| 50 desc: '"\r\n" should be considered a newline for standalone tags.' |
| 51 data: { } |
| 52 template: "|\r\n{{! Standalone Comment }}\r\n|" |
| 53 expected: "|\r\n|" |
| 54 |
| 55 - name: Standalone Without Previous Line |
| 56 desc: Standalone tags should not require a newline to precede them. |
| 57 data: { } |
| 58 template: " {{! I'm Still Standalone }}\n!" |
| 59 expected: "!" |
| 60 |
| 61 - name: Standalone Without Newline |
| 62 desc: Standalone tags should not require a newline to follow them. |
| 63 data: { } |
| 64 template: "!\n {{! I'm Still Standalone }}" |
| 65 expected: "!\n" |
| 66 |
| 67 - name: Multiline Standalone |
| 68 desc: All standalone comment lines should be removed. |
| 69 data: { } |
| 70 template: | |
| 71 Begin. |
| 72 {{! |
| 73 Something's going on here... |
| 74 }} |
| 75 End. |
| 76 expected: | |
| 77 Begin. |
| 78 End. |
| 79 |
| 80 - name: Indented Multiline Standalone |
| 81 desc: All standalone comment lines should be removed. |
| 82 data: { } |
| 83 template: | |
| 84 Begin. |
| 85 {{! |
| 86 Something's going on here... |
| 87 }} |
| 88 End. |
| 89 expected: | |
| 90 Begin. |
| 91 End. |
| 92 |
| 93 - name: Indented Inline |
| 94 desc: Inline comments should not strip whitespace |
| 95 data: { } |
| 96 template: " 12 {{! 34 }}\n" |
| 97 expected: " 12 \n" |
| 98 |
| 99 - name: Surrounding Whitespace |
| 100 desc: Comment removal should preserve surrounding whitespace. |
| 101 data: { } |
| 102 template: '12345 {{! Comment Block! }} 67890' |
| 103 expected: '12345 67890' |
OLD | NEW |