Skip to content

Commit a3732b8

Browse files
committed
Add test cases
1 parent 17388ef commit a3732b8

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/Datasets/InterpreterDataset.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
const EXAMPLE_FOR_TEMPLATE_3 = "{% for item in seq %}\n {{ item }}\n{%- endfor %}";
99
const EXAMPLE_FOR_TEMPLATE_4 = "{% for item in seq -%}\n {{ item }}\n{%- endfor %}";
1010
const EXAMPLE_COMMENT_TEMPLATE = " {# comment #}\n {# {% if true %} {% endif %} #}\n";
11+
const EXAMPLE_OBJECT_LITERAL_TEMPLATE = "{% set obj = { 'key1': 'value1', 'key2': 'value2' } %}{{ obj.key1 }} - {{ obj.key2 }}";
1112

1213
dataset('interpreterTestData', [
1314
// If tests
@@ -129,4 +130,20 @@
129130
// 'trim_blocks' => true,
130131
// 'target' => "",
131132
// ],
133+
134+
// Object literal tests
135+
'object literal (no strip or trim)' => [
136+
'template' => EXAMPLE_OBJECT_LITERAL_TEMPLATE,
137+
'data' => [],
138+
'lstrip_blocks' => false,
139+
'trim_blocks' => false,
140+
'target' => "value1 - value2",
141+
],
142+
'object literal (strip and trim)' => [
143+
'template' => EXAMPLE_OBJECT_LITERAL_TEMPLATE,
144+
'data' => [],
145+
'lstrip_blocks' => true,
146+
'trim_blocks' => true,
147+
'target' => "value1 - value2",
148+
],
132149
]);

0 commit comments

Comments
 (0)