Add parsing for conditionals (cont.)
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
974086a877
commit
8afc2d1bde
29 changed files with 994 additions and 746 deletions
31
tests/cases/1-parsed@condition.snap
Normal file
31
tests/cases/1-parsed@condition.snap
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: parsed
|
||||
input_file: tests/cases/condition.nomo
|
||||
---
|
||||
ParsedTemplate {
|
||||
tokens: [
|
||||
"{{" (0..2),
|
||||
" " (2..3),
|
||||
"if" (3..5),
|
||||
" " (5..6),
|
||||
"test" (6..10),
|
||||
" " (10..11),
|
||||
"}}" (11..13),
|
||||
"\n " (13..18),
|
||||
"Hello World!" (18..30),
|
||||
"\n" (30..31),
|
||||
"{{" (31..33),
|
||||
" " (33..34),
|
||||
"end" (34..37),
|
||||
" " (37..38),
|
||||
"}}" (38..40),
|
||||
"\n\n" (40..42),
|
||||
"{{" (42..44),
|
||||
"=" (44..45),
|
||||
" " (45..46),
|
||||
"stuff" (46..51),
|
||||
" " (51..52),
|
||||
"}}" (52..54),
|
||||
],
|
||||
}
|
||||
|
|
@ -5,174 +5,46 @@ input_file: tests/cases/identifiers.nomo
|
|||
---
|
||||
ParsedTemplate {
|
||||
tokens: [
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_name",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "a_name",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "1name",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_name1",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_namE",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name1",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
"{{" (0..2),
|
||||
"=" (2..3),
|
||||
" " (3..4),
|
||||
"_name" (4..9),
|
||||
" " (9..10),
|
||||
"}}" (10..12),
|
||||
"\n" (12..13),
|
||||
"{{" (13..15),
|
||||
"=" (15..16),
|
||||
" " (16..17),
|
||||
"a_name" (17..23),
|
||||
" " (23..24),
|
||||
"}}" (24..26),
|
||||
"\n" (26..27),
|
||||
"{{" (27..29),
|
||||
"=" (29..30),
|
||||
" " (30..31),
|
||||
"1name" (31..36),
|
||||
" " (36..37),
|
||||
"}}" (37..39),
|
||||
"\n" (39..40),
|
||||
"{{" (40..42),
|
||||
"=" (42..43),
|
||||
" " (43..44),
|
||||
"_name1" (44..50),
|
||||
" " (50..51),
|
||||
"}}" (51..53),
|
||||
"\n" (53..54),
|
||||
"{{" (54..56),
|
||||
"=" (56..57),
|
||||
" " (57..58),
|
||||
"_namE" (58..63),
|
||||
" " (63..64),
|
||||
"}}" (64..66),
|
||||
"\n" (66..67),
|
||||
"{{" (67..69),
|
||||
"=" (69..70),
|
||||
" " (70..71),
|
||||
"name1" (71..76),
|
||||
" " (76..77),
|
||||
"}}" (77..79),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,37 +5,13 @@ input_file: tests/cases/interpolation.nomo
|
|||
---
|
||||
ParsedTemplate {
|
||||
tokens: [
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hello! I'm",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
"Hello! I'm" (0..10),
|
||||
" " (10..11),
|
||||
"{{" (11..13),
|
||||
"=" (13..14),
|
||||
" " (14..15),
|
||||
"name" (15..19),
|
||||
" " (19..20),
|
||||
"}}" (20..22),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,65 +5,20 @@ input_file: tests/cases/multiple.nomo
|
|||
---
|
||||
ParsedTemplate {
|
||||
tokens: [
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hi there! My name is",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: LeftDelim,
|
||||
source: "{{",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "lastname",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: RightDelim,
|
||||
source: "}}",
|
||||
},
|
||||
"Hi there! My name is" (0..20),
|
||||
" " (20..21),
|
||||
"{{" (21..23),
|
||||
"=" (23..24),
|
||||
" " (24..25),
|
||||
"name" (25..29),
|
||||
" " (29..30),
|
||||
"}}" (30..32),
|
||||
" " (32..33),
|
||||
"{{" (33..35),
|
||||
"=" (35..36),
|
||||
" " (36..37),
|
||||
"lastname" (37..45),
|
||||
" " (45..46),
|
||||
"}}" (46..48),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ input_file: tests/cases/simple.nomo
|
|||
---
|
||||
ParsedTemplate {
|
||||
tokens: [
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hello World!",
|
||||
},
|
||||
"Hello World!" (0..12),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
45
tests/cases/2-ast@condition.snap
Normal file
45
tests/cases/2-ast@condition.snap
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: ast
|
||||
input_file: tests/cases/condition.nomo
|
||||
---
|
||||
TemplateAst {
|
||||
root: [
|
||||
ConditionalChain {
|
||||
chain: [
|
||||
IfConditional {
|
||||
if_block: Block {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
"test" (6..10),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
"\n " (13..18),
|
||||
),
|
||||
},
|
||||
content: [
|
||||
StaticContent(
|
||||
"Hello World!" (18..30),
|
||||
),
|
||||
],
|
||||
end_block: Block {
|
||||
prev_whitespace_content: Some(
|
||||
"\n" (30..31),
|
||||
),
|
||||
expression: EndBlock,
|
||||
post_whitespace_content: Some(
|
||||
"\n\n" (40..42),
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
"stuff" (46..51),
|
||||
),
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -7,115 +7,53 @@ TemplateAst {
|
|||
root: [
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_name",
|
||||
},
|
||||
"_name" (4..9),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
"\n" (12..13),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "a_name",
|
||||
},
|
||||
"a_name" (17..23),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
"\n" (26..27),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "1name",
|
||||
},
|
||||
"1name" (31..36),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
"\n" (39..40),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_name1",
|
||||
},
|
||||
"_name1" (44..50),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
"\n" (53..54),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "_namE",
|
||||
},
|
||||
"_namE" (58..63),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: "
|
||||
",
|
||||
},
|
||||
"\n" (66..67),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name1",
|
||||
},
|
||||
"name1" (71..76),
|
||||
),
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,27 +6,14 @@ input_file: tests/cases/interpolation.nomo
|
|||
TemplateAst {
|
||||
root: [
|
||||
StaticContent(
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hello! I'm",
|
||||
},
|
||||
"Hello! I'm" (0..10),
|
||||
),
|
||||
Interpolation {
|
||||
prev_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
" " (10..11),
|
||||
),
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name",
|
||||
},
|
||||
"name" (15..19),
|
||||
),
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,46 +6,23 @@ input_file: tests/cases/multiple.nomo
|
|||
TemplateAst {
|
||||
root: [
|
||||
StaticContent(
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hi there! My name is",
|
||||
},
|
||||
"Hi there! My name is" (0..20),
|
||||
),
|
||||
Interpolation {
|
||||
prev_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
" " (20..21),
|
||||
),
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "name",
|
||||
},
|
||||
"name" (25..29),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
TemplateToken {
|
||||
kind: Whitespace,
|
||||
source: " ",
|
||||
},
|
||||
" " (32..33),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
wants_output: TemplateToken {
|
||||
kind: WantsOutput,
|
||||
source: "=",
|
||||
},
|
||||
expression: VariableAccess(
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
source: "lastname",
|
||||
},
|
||||
"lastname" (37..45),
|
||||
),
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ input_file: tests/cases/simple.nomo
|
|||
TemplateAst {
|
||||
root: [
|
||||
StaticContent(
|
||||
TemplateToken {
|
||||
kind: Content,
|
||||
source: "Hello World!",
|
||||
},
|
||||
"Hello World!" (0..12),
|
||||
),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
42
tests/cases/3-instructions@condition.snap
Normal file
42
tests/cases/3-instructions@condition.snap
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: emit
|
||||
input_file: tests/cases/condition.nomo
|
||||
---
|
||||
[
|
||||
LoadFromContextToSlot {
|
||||
name: "test" (6..10),
|
||||
slot: VariableSlot {
|
||||
index: 0,
|
||||
},
|
||||
},
|
||||
JumpIfNotTrue {
|
||||
emit_slot: VariableSlot {
|
||||
index: 0,
|
||||
},
|
||||
jump: 3,
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n " (13..18),
|
||||
},
|
||||
AppendContent {
|
||||
content: "Hello World!" (18..30),
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (30..31),
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n\n" (40..42),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "stuff" (46..51),
|
||||
slot: VariableSlot {
|
||||
index: 1,
|
||||
},
|
||||
},
|
||||
EmitFromSlot {
|
||||
slot: VariableSlot {
|
||||
index: 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
@ -5,7 +5,7 @@ input_file: tests/cases/identifiers.nomo
|
|||
---
|
||||
[
|
||||
LoadFromContextToSlot {
|
||||
name: "_name",
|
||||
name: "_name" (4..9),
|
||||
slot: VariableSlot {
|
||||
index: 0,
|
||||
},
|
||||
|
|
@ -16,11 +16,10 @@ input_file: tests/cases/identifiers.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "
|
||||
",
|
||||
content: "\n" (12..13),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "a_name",
|
||||
name: "a_name" (17..23),
|
||||
slot: VariableSlot {
|
||||
index: 1,
|
||||
},
|
||||
|
|
@ -31,11 +30,10 @@ input_file: tests/cases/identifiers.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "
|
||||
",
|
||||
content: "\n" (26..27),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "1name",
|
||||
name: "1name" (31..36),
|
||||
slot: VariableSlot {
|
||||
index: 2,
|
||||
},
|
||||
|
|
@ -46,11 +44,10 @@ input_file: tests/cases/identifiers.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "
|
||||
",
|
||||
content: "\n" (39..40),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "_name1",
|
||||
name: "_name1" (44..50),
|
||||
slot: VariableSlot {
|
||||
index: 3,
|
||||
},
|
||||
|
|
@ -61,11 +58,10 @@ input_file: tests/cases/identifiers.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "
|
||||
",
|
||||
content: "\n" (53..54),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "_namE",
|
||||
name: "_namE" (58..63),
|
||||
slot: VariableSlot {
|
||||
index: 4,
|
||||
},
|
||||
|
|
@ -76,11 +72,10 @@ input_file: tests/cases/identifiers.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "
|
||||
",
|
||||
content: "\n" (66..67),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "name1",
|
||||
name: "name1" (71..76),
|
||||
slot: VariableSlot {
|
||||
index: 5,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ input_file: tests/cases/interpolation.nomo
|
|||
---
|
||||
[
|
||||
AppendContent {
|
||||
content: "Hello! I'm",
|
||||
content: "Hello! I'm" (0..10),
|
||||
},
|
||||
AppendContent {
|
||||
content: " ",
|
||||
content: " " (10..11),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "name",
|
||||
name: "name" (15..19),
|
||||
slot: VariableSlot {
|
||||
index: 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ input_file: tests/cases/multiple.nomo
|
|||
---
|
||||
[
|
||||
AppendContent {
|
||||
content: "Hi there! My name is",
|
||||
content: "Hi there! My name is" (0..20),
|
||||
},
|
||||
AppendContent {
|
||||
content: " ",
|
||||
content: " " (20..21),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "name",
|
||||
name: "name" (25..29),
|
||||
slot: VariableSlot {
|
||||
index: 0,
|
||||
},
|
||||
|
|
@ -22,10 +22,10 @@ input_file: tests/cases/multiple.nomo
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: " ",
|
||||
content: " " (32..33),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "lastname",
|
||||
name: "lastname" (37..45),
|
||||
slot: VariableSlot {
|
||||
index: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ input_file: tests/cases/simple.nomo
|
|||
---
|
||||
[
|
||||
AppendContent {
|
||||
content: "Hello World!",
|
||||
content: "Hello World!" (0..12),
|
||||
},
|
||||
]
|
||||
|
|
|
|||
6
tests/cases/4-output@condition.snap
Normal file
6
tests/cases/4-output@condition.snap
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: output
|
||||
input_file: tests/cases/condition.nomo
|
||||
---
|
||||
"\n Hello World!\n\n\nmore"
|
||||
10
tests/cases/condition.nomo
Normal file
10
tests/cases/condition.nomo
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"test": true,
|
||||
"stuff": "more"
|
||||
}
|
||||
---
|
||||
{{ if test }}
|
||||
Hello World!
|
||||
{{ end }}
|
||||
|
||||
{{= stuff }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue