liquid-4-0-2 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.md +235 -0
- data/LICENSE +20 -0
- data/README.md +108 -0
- data/lib/liquid.rb +80 -0
- data/lib/liquid/block.rb +77 -0
- data/lib/liquid/block_body.rb +142 -0
- data/lib/liquid/condition.rb +151 -0
- data/lib/liquid/context.rb +226 -0
- data/lib/liquid/document.rb +27 -0
- data/lib/liquid/drop.rb +78 -0
- data/lib/liquid/errors.rb +56 -0
- data/lib/liquid/expression.rb +49 -0
- data/lib/liquid/extensions.rb +74 -0
- data/lib/liquid/file_system.rb +73 -0
- data/lib/liquid/forloop_drop.rb +42 -0
- data/lib/liquid/i18n.rb +39 -0
- data/lib/liquid/interrupts.rb +16 -0
- data/lib/liquid/lexer.rb +55 -0
- data/lib/liquid/locales/en.yml +26 -0
- data/lib/liquid/parse_context.rb +38 -0
- data/lib/liquid/parse_tree_visitor.rb +42 -0
- data/lib/liquid/parser.rb +90 -0
- data/lib/liquid/parser_switching.rb +31 -0
- data/lib/liquid/profiler.rb +158 -0
- data/lib/liquid/profiler/hooks.rb +23 -0
- data/lib/liquid/range_lookup.rb +37 -0
- data/lib/liquid/resource_limits.rb +23 -0
- data/lib/liquid/standardfilters.rb +485 -0
- data/lib/liquid/strainer.rb +66 -0
- data/lib/liquid/tablerowloop_drop.rb +62 -0
- data/lib/liquid/tag.rb +43 -0
- data/lib/liquid/tags/assign.rb +59 -0
- data/lib/liquid/tags/break.rb +18 -0
- data/lib/liquid/tags/capture.rb +38 -0
- data/lib/liquid/tags/case.rb +94 -0
- data/lib/liquid/tags/comment.rb +16 -0
- data/lib/liquid/tags/continue.rb +18 -0
- data/lib/liquid/tags/cycle.rb +65 -0
- data/lib/liquid/tags/decrement.rb +35 -0
- data/lib/liquid/tags/for.rb +203 -0
- data/lib/liquid/tags/if.rb +122 -0
- data/lib/liquid/tags/ifchanged.rb +18 -0
- data/lib/liquid/tags/include.rb +124 -0
- data/lib/liquid/tags/increment.rb +31 -0
- data/lib/liquid/tags/raw.rb +47 -0
- data/lib/liquid/tags/table_row.rb +62 -0
- data/lib/liquid/tags/unless.rb +30 -0
- data/lib/liquid/template.rb +254 -0
- data/lib/liquid/tokenizer.rb +31 -0
- data/lib/liquid/utils.rb +83 -0
- data/lib/liquid/variable.rb +148 -0
- data/lib/liquid/variable_lookup.rb +88 -0
- data/lib/liquid/version.rb +4 -0
- data/test/fixtures/en_locale.yml +9 -0
- data/test/integration/assign_test.rb +48 -0
- data/test/integration/blank_test.rb +106 -0
- data/test/integration/block_test.rb +12 -0
- data/test/integration/capture_test.rb +50 -0
- data/test/integration/context_test.rb +32 -0
- data/test/integration/document_test.rb +19 -0
- data/test/integration/drop_test.rb +273 -0
- data/test/integration/error_handling_test.rb +260 -0
- data/test/integration/filter_test.rb +178 -0
- data/test/integration/hash_ordering_test.rb +23 -0
- data/test/integration/output_test.rb +123 -0
- data/test/integration/parse_tree_visitor_test.rb +247 -0
- data/test/integration/parsing_quirks_test.rb +122 -0
- data/test/integration/render_profiling_test.rb +154 -0
- data/test/integration/security_test.rb +80 -0
- data/test/integration/standard_filter_test.rb +698 -0
- data/test/integration/tags/break_tag_test.rb +15 -0
- data/test/integration/tags/continue_tag_test.rb +15 -0
- data/test/integration/tags/for_tag_test.rb +410 -0
- data/test/integration/tags/if_else_tag_test.rb +188 -0
- data/test/integration/tags/include_tag_test.rb +245 -0
- data/test/integration/tags/increment_tag_test.rb +23 -0
- data/test/integration/tags/raw_tag_test.rb +31 -0
- data/test/integration/tags/standard_tag_test.rb +296 -0
- data/test/integration/tags/statements_test.rb +111 -0
- data/test/integration/tags/table_row_test.rb +64 -0
- data/test/integration/tags/unless_else_tag_test.rb +26 -0
- data/test/integration/template_test.rb +332 -0
- data/test/integration/trim_mode_test.rb +529 -0
- data/test/integration/variable_test.rb +96 -0
- data/test/test_helper.rb +116 -0
- data/test/unit/block_unit_test.rb +58 -0
- data/test/unit/condition_unit_test.rb +166 -0
- data/test/unit/context_unit_test.rb +489 -0
- data/test/unit/file_system_unit_test.rb +35 -0
- data/test/unit/i18n_unit_test.rb +37 -0
- data/test/unit/lexer_unit_test.rb +51 -0
- data/test/unit/parser_unit_test.rb +82 -0
- data/test/unit/regexp_unit_test.rb +44 -0
- data/test/unit/strainer_unit_test.rb +164 -0
- data/test/unit/tag_unit_test.rb +21 -0
- data/test/unit/tags/case_tag_unit_test.rb +10 -0
- data/test/unit/tags/for_tag_unit_test.rb +13 -0
- data/test/unit/tags/if_tag_unit_test.rb +8 -0
- data/test/unit/template_unit_test.rb +78 -0
- data/test/unit/tokenizer_unit_test.rb +55 -0
- data/test/unit/variable_unit_test.rb +162 -0
- metadata +224 -0
@@ -0,0 +1,529 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TrimModeTest < Minitest::Test
|
4
|
+
include Liquid
|
5
|
+
|
6
|
+
# Make sure the trim isn't applied to standard output
|
7
|
+
def test_standard_output
|
8
|
+
text = <<-END_TEMPLATE
|
9
|
+
<div>
|
10
|
+
<p>
|
11
|
+
{{ 'John' }}
|
12
|
+
</p>
|
13
|
+
</div>
|
14
|
+
END_TEMPLATE
|
15
|
+
expected = <<-END_EXPECTED
|
16
|
+
<div>
|
17
|
+
<p>
|
18
|
+
John
|
19
|
+
</p>
|
20
|
+
</div>
|
21
|
+
END_EXPECTED
|
22
|
+
assert_template_result(expected, text)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_variable_output_with_multiple_blank_lines
|
26
|
+
text = <<-END_TEMPLATE
|
27
|
+
<div>
|
28
|
+
<p>
|
29
|
+
|
30
|
+
|
31
|
+
{{- 'John' -}}
|
32
|
+
|
33
|
+
|
34
|
+
</p>
|
35
|
+
</div>
|
36
|
+
END_TEMPLATE
|
37
|
+
expected = <<-END_EXPECTED
|
38
|
+
<div>
|
39
|
+
<p>John</p>
|
40
|
+
</div>
|
41
|
+
END_EXPECTED
|
42
|
+
assert_template_result(expected, text)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_tag_output_with_multiple_blank_lines
|
46
|
+
text = <<-END_TEMPLATE
|
47
|
+
<div>
|
48
|
+
<p>
|
49
|
+
|
50
|
+
|
51
|
+
{%- if true -%}
|
52
|
+
yes
|
53
|
+
{%- endif -%}
|
54
|
+
|
55
|
+
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
END_TEMPLATE
|
59
|
+
expected = <<-END_EXPECTED
|
60
|
+
<div>
|
61
|
+
<p>yes</p>
|
62
|
+
</div>
|
63
|
+
END_EXPECTED
|
64
|
+
assert_template_result(expected, text)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Make sure the trim isn't applied to standard tags
|
68
|
+
def test_standard_tags
|
69
|
+
whitespace = ' '
|
70
|
+
text = <<-END_TEMPLATE
|
71
|
+
<div>
|
72
|
+
<p>
|
73
|
+
{% if true %}
|
74
|
+
yes
|
75
|
+
{% endif %}
|
76
|
+
</p>
|
77
|
+
</div>
|
78
|
+
END_TEMPLATE
|
79
|
+
expected = <<-END_EXPECTED
|
80
|
+
<div>
|
81
|
+
<p>
|
82
|
+
#{whitespace}
|
83
|
+
yes
|
84
|
+
#{whitespace}
|
85
|
+
</p>
|
86
|
+
</div>
|
87
|
+
END_EXPECTED
|
88
|
+
assert_template_result(expected, text)
|
89
|
+
|
90
|
+
text = <<-END_TEMPLATE
|
91
|
+
<div>
|
92
|
+
<p>
|
93
|
+
{% if false %}
|
94
|
+
no
|
95
|
+
{% endif %}
|
96
|
+
</p>
|
97
|
+
</div>
|
98
|
+
END_TEMPLATE
|
99
|
+
expected = <<-END_EXPECTED
|
100
|
+
<div>
|
101
|
+
<p>
|
102
|
+
#{whitespace}
|
103
|
+
</p>
|
104
|
+
</div>
|
105
|
+
END_EXPECTED
|
106
|
+
assert_template_result(expected, text)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Make sure the trim isn't too agressive
|
110
|
+
def test_no_trim_output
|
111
|
+
text = '<p>{{- \'John\' -}}</p>'
|
112
|
+
expected = '<p>John</p>'
|
113
|
+
assert_template_result(expected, text)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Make sure the trim isn't too agressive
|
117
|
+
def test_no_trim_tags
|
118
|
+
text = '<p>{%- if true -%}yes{%- endif -%}</p>'
|
119
|
+
expected = '<p>yes</p>'
|
120
|
+
assert_template_result(expected, text)
|
121
|
+
|
122
|
+
text = '<p>{%- if false -%}no{%- endif -%}</p>'
|
123
|
+
expected = '<p></p>'
|
124
|
+
assert_template_result(expected, text)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_single_line_outer_tag
|
128
|
+
text = '<p> {%- if true %} yes {% endif -%} </p>'
|
129
|
+
expected = '<p> yes </p>'
|
130
|
+
assert_template_result(expected, text)
|
131
|
+
|
132
|
+
text = '<p> {%- if false %} no {% endif -%} </p>'
|
133
|
+
expected = '<p></p>'
|
134
|
+
assert_template_result(expected, text)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_single_line_inner_tag
|
138
|
+
text = '<p> {% if true -%} yes {%- endif %} </p>'
|
139
|
+
expected = '<p> yes </p>'
|
140
|
+
assert_template_result(expected, text)
|
141
|
+
|
142
|
+
text = '<p> {% if false -%} no {%- endif %} </p>'
|
143
|
+
expected = '<p> </p>'
|
144
|
+
assert_template_result(expected, text)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_single_line_post_tag
|
148
|
+
text = '<p> {% if true -%} yes {% endif -%} </p>'
|
149
|
+
expected = '<p> yes </p>'
|
150
|
+
assert_template_result(expected, text)
|
151
|
+
|
152
|
+
text = '<p> {% if false -%} no {% endif -%} </p>'
|
153
|
+
expected = '<p> </p>'
|
154
|
+
assert_template_result(expected, text)
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_single_line_pre_tag
|
158
|
+
text = '<p> {%- if true %} yes {%- endif %} </p>'
|
159
|
+
expected = '<p> yes </p>'
|
160
|
+
assert_template_result(expected, text)
|
161
|
+
|
162
|
+
text = '<p> {%- if false %} no {%- endif %} </p>'
|
163
|
+
expected = '<p> </p>'
|
164
|
+
assert_template_result(expected, text)
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_pre_trim_output
|
168
|
+
text = <<-END_TEMPLATE
|
169
|
+
<div>
|
170
|
+
<p>
|
171
|
+
{{- 'John' }}
|
172
|
+
</p>
|
173
|
+
</div>
|
174
|
+
END_TEMPLATE
|
175
|
+
expected = <<-END_EXPECTED
|
176
|
+
<div>
|
177
|
+
<p>John
|
178
|
+
</p>
|
179
|
+
</div>
|
180
|
+
END_EXPECTED
|
181
|
+
assert_template_result(expected, text)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_pre_trim_tags
|
185
|
+
text = <<-END_TEMPLATE
|
186
|
+
<div>
|
187
|
+
<p>
|
188
|
+
{%- if true %}
|
189
|
+
yes
|
190
|
+
{%- endif %}
|
191
|
+
</p>
|
192
|
+
</div>
|
193
|
+
END_TEMPLATE
|
194
|
+
expected = <<-END_EXPECTED
|
195
|
+
<div>
|
196
|
+
<p>
|
197
|
+
yes
|
198
|
+
</p>
|
199
|
+
</div>
|
200
|
+
END_EXPECTED
|
201
|
+
assert_template_result(expected, text)
|
202
|
+
|
203
|
+
text = <<-END_TEMPLATE
|
204
|
+
<div>
|
205
|
+
<p>
|
206
|
+
{%- if false %}
|
207
|
+
no
|
208
|
+
{%- endif %}
|
209
|
+
</p>
|
210
|
+
</div>
|
211
|
+
END_TEMPLATE
|
212
|
+
expected = <<-END_EXPECTED
|
213
|
+
<div>
|
214
|
+
<p>
|
215
|
+
</p>
|
216
|
+
</div>
|
217
|
+
END_EXPECTED
|
218
|
+
assert_template_result(expected, text)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_post_trim_output
|
222
|
+
text = <<-END_TEMPLATE
|
223
|
+
<div>
|
224
|
+
<p>
|
225
|
+
{{ 'John' -}}
|
226
|
+
</p>
|
227
|
+
</div>
|
228
|
+
END_TEMPLATE
|
229
|
+
expected = <<-END_EXPECTED
|
230
|
+
<div>
|
231
|
+
<p>
|
232
|
+
John</p>
|
233
|
+
</div>
|
234
|
+
END_EXPECTED
|
235
|
+
assert_template_result(expected, text)
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_post_trim_tags
|
239
|
+
text = <<-END_TEMPLATE
|
240
|
+
<div>
|
241
|
+
<p>
|
242
|
+
{% if true -%}
|
243
|
+
yes
|
244
|
+
{% endif -%}
|
245
|
+
</p>
|
246
|
+
</div>
|
247
|
+
END_TEMPLATE
|
248
|
+
expected = <<-END_EXPECTED
|
249
|
+
<div>
|
250
|
+
<p>
|
251
|
+
yes
|
252
|
+
</p>
|
253
|
+
</div>
|
254
|
+
END_EXPECTED
|
255
|
+
assert_template_result(expected, text)
|
256
|
+
|
257
|
+
text = <<-END_TEMPLATE
|
258
|
+
<div>
|
259
|
+
<p>
|
260
|
+
{% if false -%}
|
261
|
+
no
|
262
|
+
{% endif -%}
|
263
|
+
</p>
|
264
|
+
</div>
|
265
|
+
END_TEMPLATE
|
266
|
+
expected = <<-END_EXPECTED
|
267
|
+
<div>
|
268
|
+
<p>
|
269
|
+
</p>
|
270
|
+
</div>
|
271
|
+
END_EXPECTED
|
272
|
+
assert_template_result(expected, text)
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_pre_and_post_trim_tags
|
276
|
+
text = <<-END_TEMPLATE
|
277
|
+
<div>
|
278
|
+
<p>
|
279
|
+
{%- if true %}
|
280
|
+
yes
|
281
|
+
{% endif -%}
|
282
|
+
</p>
|
283
|
+
</div>
|
284
|
+
END_TEMPLATE
|
285
|
+
expected = <<-END_EXPECTED
|
286
|
+
<div>
|
287
|
+
<p>
|
288
|
+
yes
|
289
|
+
</p>
|
290
|
+
</div>
|
291
|
+
END_EXPECTED
|
292
|
+
assert_template_result(expected, text)
|
293
|
+
|
294
|
+
text = <<-END_TEMPLATE
|
295
|
+
<div>
|
296
|
+
<p>
|
297
|
+
{%- if false %}
|
298
|
+
no
|
299
|
+
{% endif -%}
|
300
|
+
</p>
|
301
|
+
</div>
|
302
|
+
END_TEMPLATE
|
303
|
+
expected = <<-END_EXPECTED
|
304
|
+
<div>
|
305
|
+
<p></p>
|
306
|
+
</div>
|
307
|
+
END_EXPECTED
|
308
|
+
assert_template_result(expected, text)
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_post_and_pre_trim_tags
|
312
|
+
text = <<-END_TEMPLATE
|
313
|
+
<div>
|
314
|
+
<p>
|
315
|
+
{% if true -%}
|
316
|
+
yes
|
317
|
+
{%- endif %}
|
318
|
+
</p>
|
319
|
+
</div>
|
320
|
+
END_TEMPLATE
|
321
|
+
expected = <<-END_EXPECTED
|
322
|
+
<div>
|
323
|
+
<p>
|
324
|
+
yes
|
325
|
+
</p>
|
326
|
+
</div>
|
327
|
+
END_EXPECTED
|
328
|
+
assert_template_result(expected, text)
|
329
|
+
|
330
|
+
whitespace = ' '
|
331
|
+
text = <<-END_TEMPLATE
|
332
|
+
<div>
|
333
|
+
<p>
|
334
|
+
{% if false -%}
|
335
|
+
no
|
336
|
+
{%- endif %}
|
337
|
+
</p>
|
338
|
+
</div>
|
339
|
+
END_TEMPLATE
|
340
|
+
expected = <<-END_EXPECTED
|
341
|
+
<div>
|
342
|
+
<p>
|
343
|
+
#{whitespace}
|
344
|
+
</p>
|
345
|
+
</div>
|
346
|
+
END_EXPECTED
|
347
|
+
assert_template_result(expected, text)
|
348
|
+
end
|
349
|
+
|
350
|
+
def test_trim_output
|
351
|
+
text = <<-END_TEMPLATE
|
352
|
+
<div>
|
353
|
+
<p>
|
354
|
+
{{- 'John' -}}
|
355
|
+
</p>
|
356
|
+
</div>
|
357
|
+
END_TEMPLATE
|
358
|
+
expected = <<-END_EXPECTED
|
359
|
+
<div>
|
360
|
+
<p>John</p>
|
361
|
+
</div>
|
362
|
+
END_EXPECTED
|
363
|
+
assert_template_result(expected, text)
|
364
|
+
end
|
365
|
+
|
366
|
+
def test_trim_tags
|
367
|
+
text = <<-END_TEMPLATE
|
368
|
+
<div>
|
369
|
+
<p>
|
370
|
+
{%- if true -%}
|
371
|
+
yes
|
372
|
+
{%- endif -%}
|
373
|
+
</p>
|
374
|
+
</div>
|
375
|
+
END_TEMPLATE
|
376
|
+
expected = <<-END_EXPECTED
|
377
|
+
<div>
|
378
|
+
<p>yes</p>
|
379
|
+
</div>
|
380
|
+
END_EXPECTED
|
381
|
+
assert_template_result(expected, text)
|
382
|
+
|
383
|
+
text = <<-END_TEMPLATE
|
384
|
+
<div>
|
385
|
+
<p>
|
386
|
+
{%- if false -%}
|
387
|
+
no
|
388
|
+
{%- endif -%}
|
389
|
+
</p>
|
390
|
+
</div>
|
391
|
+
END_TEMPLATE
|
392
|
+
expected = <<-END_EXPECTED
|
393
|
+
<div>
|
394
|
+
<p></p>
|
395
|
+
</div>
|
396
|
+
END_EXPECTED
|
397
|
+
assert_template_result(expected, text)
|
398
|
+
end
|
399
|
+
|
400
|
+
def test_whitespace_trim_output
|
401
|
+
text = <<-END_TEMPLATE
|
402
|
+
<div>
|
403
|
+
<p>
|
404
|
+
{{- 'John' -}},
|
405
|
+
{{- '30' -}}
|
406
|
+
</p>
|
407
|
+
</div>
|
408
|
+
END_TEMPLATE
|
409
|
+
expected = <<-END_EXPECTED
|
410
|
+
<div>
|
411
|
+
<p>John,30</p>
|
412
|
+
</div>
|
413
|
+
END_EXPECTED
|
414
|
+
assert_template_result(expected, text)
|
415
|
+
end
|
416
|
+
|
417
|
+
def test_whitespace_trim_tags
|
418
|
+
text = <<-END_TEMPLATE
|
419
|
+
<div>
|
420
|
+
<p>
|
421
|
+
{%- if true -%}
|
422
|
+
yes
|
423
|
+
{%- endif -%}
|
424
|
+
</p>
|
425
|
+
</div>
|
426
|
+
END_TEMPLATE
|
427
|
+
expected = <<-END_EXPECTED
|
428
|
+
<div>
|
429
|
+
<p>yes</p>
|
430
|
+
</div>
|
431
|
+
END_EXPECTED
|
432
|
+
assert_template_result(expected, text)
|
433
|
+
|
434
|
+
text = <<-END_TEMPLATE
|
435
|
+
<div>
|
436
|
+
<p>
|
437
|
+
{%- if false -%}
|
438
|
+
no
|
439
|
+
{%- endif -%}
|
440
|
+
</p>
|
441
|
+
</div>
|
442
|
+
END_TEMPLATE
|
443
|
+
expected = <<-END_EXPECTED
|
444
|
+
<div>
|
445
|
+
<p></p>
|
446
|
+
</div>
|
447
|
+
END_EXPECTED
|
448
|
+
assert_template_result(expected, text)
|
449
|
+
end
|
450
|
+
|
451
|
+
def test_complex_trim_output
|
452
|
+
text = <<-END_TEMPLATE
|
453
|
+
<div>
|
454
|
+
<p>
|
455
|
+
{{- 'John' -}}
|
456
|
+
{{- '30' -}}
|
457
|
+
</p>
|
458
|
+
<b>
|
459
|
+
{{ 'John' -}}
|
460
|
+
{{- '30' }}
|
461
|
+
</b>
|
462
|
+
<i>
|
463
|
+
{{- 'John' }}
|
464
|
+
{{ '30' -}}
|
465
|
+
</i>
|
466
|
+
</div>
|
467
|
+
END_TEMPLATE
|
468
|
+
expected = <<-END_EXPECTED
|
469
|
+
<div>
|
470
|
+
<p>John30</p>
|
471
|
+
<b>
|
472
|
+
John30
|
473
|
+
</b>
|
474
|
+
<i>John
|
475
|
+
30</i>
|
476
|
+
</div>
|
477
|
+
END_EXPECTED
|
478
|
+
assert_template_result(expected, text)
|
479
|
+
end
|
480
|
+
|
481
|
+
def test_complex_trim
|
482
|
+
text = <<-END_TEMPLATE
|
483
|
+
<div>
|
484
|
+
{%- if true -%}
|
485
|
+
{%- if true -%}
|
486
|
+
<p>
|
487
|
+
{{- 'John' -}}
|
488
|
+
</p>
|
489
|
+
{%- endif -%}
|
490
|
+
{%- endif -%}
|
491
|
+
</div>
|
492
|
+
END_TEMPLATE
|
493
|
+
expected = <<-END_EXPECTED
|
494
|
+
<div><p>John</p></div>
|
495
|
+
END_EXPECTED
|
496
|
+
assert_template_result(expected, text)
|
497
|
+
end
|
498
|
+
|
499
|
+
def test_right_trim_followed_by_tag
|
500
|
+
assert_template_result('ab c', '{{ "a" -}}{{ "b" }} c')
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_raw_output
|
504
|
+
whitespace = ' '
|
505
|
+
text = <<-END_TEMPLATE
|
506
|
+
<div>
|
507
|
+
{% raw %}
|
508
|
+
{%- if true -%}
|
509
|
+
<p>
|
510
|
+
{{- 'John' -}}
|
511
|
+
</p>
|
512
|
+
{%- endif -%}
|
513
|
+
{% endraw %}
|
514
|
+
</div>
|
515
|
+
END_TEMPLATE
|
516
|
+
expected = <<-END_EXPECTED
|
517
|
+
<div>
|
518
|
+
#{whitespace}
|
519
|
+
{%- if true -%}
|
520
|
+
<p>
|
521
|
+
{{- 'John' -}}
|
522
|
+
</p>
|
523
|
+
{%- endif -%}
|
524
|
+
#{whitespace}
|
525
|
+
</div>
|
526
|
+
END_EXPECTED
|
527
|
+
assert_template_result(expected, text)
|
528
|
+
end
|
529
|
+
end # TrimModeTest
|