Add tests for for loop
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
42e0056374
commit
dc8281036c
7 changed files with 178 additions and 2 deletions
|
|
@ -2,7 +2,9 @@
|
|||
source: tests/file_tests.rs
|
||||
expression: emit
|
||||
info:
|
||||
input: "{{ for value in values -}}\n {{-= value }}\n{{- end }}\n{{ for value in no_values -}}\n {{-= value }}\n{{ else -}}\nNo Values >:C\n{{- end }}"
|
||||
context:
|
||||
no_values: []
|
||||
values:
|
||||
- one
|
||||
- two
|
||||
|
|
@ -19,6 +21,15 @@ VMInstructions {
|
|||
LabelSlot {
|
||||
index: 2,
|
||||
}: 4,
|
||||
LabelSlot {
|
||||
index: 7,
|
||||
}: 22,
|
||||
LabelSlot {
|
||||
index: 8,
|
||||
}: 23,
|
||||
LabelSlot {
|
||||
index: 9,
|
||||
}: 16,
|
||||
},
|
||||
instructions: [
|
||||
PushScope {
|
||||
|
|
@ -83,5 +94,73 @@ VMInstructions {
|
|||
},
|
||||
},
|
||||
PopScope,
|
||||
AppendContent {
|
||||
content: "\n" (55..56),
|
||||
},
|
||||
PushScope {
|
||||
inherit_parent: true,
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "no_values" (72..81),
|
||||
slot: VariableSlot {
|
||||
index: 11,
|
||||
},
|
||||
},
|
||||
CreateIteratorFromSlotToSlot {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 12,
|
||||
},
|
||||
iterator_source_slot: VariableSlot {
|
||||
index: 11,
|
||||
},
|
||||
},
|
||||
GetIteratorEmptyOrJump {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 12,
|
||||
},
|
||||
jump: LabelSlot {
|
||||
index: 7,
|
||||
},
|
||||
},
|
||||
AdvanceIteratorOrJump {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 12,
|
||||
},
|
||||
value_slot: VariableSlot {
|
||||
index: 10,
|
||||
},
|
||||
jump: LabelSlot {
|
||||
index: 8,
|
||||
},
|
||||
},
|
||||
LoadFromSlotToContext {
|
||||
value_ident: "value" (63..68),
|
||||
value_slot: VariableSlot {
|
||||
index: 10,
|
||||
},
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "value" (95..100),
|
||||
slot: VariableSlot {
|
||||
index: 13,
|
||||
},
|
||||
},
|
||||
EmitFromSlot {
|
||||
slot: VariableSlot {
|
||||
index: 13,
|
||||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (103..104),
|
||||
},
|
||||
Jump {
|
||||
jump: LabelSlot {
|
||||
index: 9,
|
||||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "No Values >:C" (116..129),
|
||||
},
|
||||
PopScope,
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue