diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-04/ast.snap b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/ast.snap new file mode 100644 index 0000000..313013b --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/ast.snap @@ -0,0 +1,33 @@ +--- +source: crates/fuse-parser/tests/cases/mod.rs +expression: parsed.chunk +input_file: crates/fuse-parser/tests/cases/pass/string-interpolation-04/case.fuse +--- +Some(Chunk( + span: Span( + start: 0, + end: 24, + ), + body: Block( + statements: [ + Expression(StringLiteral(StringLiteral( + span: Span( + start: 0, + end: 24, + ), + segments: [ + Interpolated(InterpolatedStringSegment( + expression: BooleanLiteral(BooleanLiteral( + span: Span( + start: 10, + end: 14, + ), + value: true, + )), + format: Display, + )), + ], + ))), + ], + ), +)) diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-04/case.fuse b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/case.fuse new file mode 100644 index 0000000..924a0f7 --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/case.fuse @@ -0,0 +1 @@ +"Hello, ${true}, World" diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-04/tokens.snap b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/tokens.snap new file mode 100644 index 0000000..e2bd096 --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-04/tokens.snap @@ -0,0 +1,81 @@ +--- +source: crates/fuse-parser/tests/cases/mod.rs +expression: tokens +input_file: crates/fuse-parser/tests/cases/pass/string-interpolation-04/case.fuse +--- +[ + TokenReference( + token: Token( + span: Span( + start: 0, + end: 10, + ), + kind: InterpolatedStringHead, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 10, + end: 14, + ), + kind: True, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 14, + end: 15, + ), + kind: RCurly, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 15, + end: 16, + ), + kind: Undetermined, + ), + leading_trivia: [], + trailing_trivia: [ + Token( + span: Span( + start: 16, + end: 17, + ), + kind: Whitespace, + ), + ], + ), + TokenReference( + token: Token( + span: Span( + start: 17, + end: 22, + ), + kind: Identifier, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 22, + end: 24, + ), + kind: StringLiteral, + ), + leading_trivia: [], + trailing_trivia: [], + ), +] diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-05/ast.snap b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/ast.snap new file mode 100644 index 0000000..6767349 --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/ast.snap @@ -0,0 +1,33 @@ +--- +source: crates/fuse-parser/tests/cases/mod.rs +expression: parsed.chunk +input_file: crates/fuse-parser/tests/cases/pass/string-interpolation-05/case.fuse +--- +Some(Chunk( + span: Span( + start: 0, + end: 25, + ), + body: Block( + statements: [ + Expression(StringLiteral(StringLiteral( + span: Span( + start: 0, + end: 25, + ), + segments: [ + Interpolated(InterpolatedStringSegment( + expression: BooleanLiteral(BooleanLiteral( + span: Span( + start: 10, + end: 15, + ), + value: false, + )), + format: Display, + )), + ], + ))), + ], + ), +)) diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-05/case.fuse b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/case.fuse new file mode 100644 index 0000000..137a3d0 --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/case.fuse @@ -0,0 +1 @@ +"Hello, ${false}, World" diff --git a/crates/fuse-parser/tests/cases/pass/string-interpolation-05/tokens.snap b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/tokens.snap new file mode 100644 index 0000000..09dcfa3 --- /dev/null +++ b/crates/fuse-parser/tests/cases/pass/string-interpolation-05/tokens.snap @@ -0,0 +1,81 @@ +--- +source: crates/fuse-parser/tests/cases/mod.rs +expression: tokens +input_file: crates/fuse-parser/tests/cases/pass/string-interpolation-05/case.fuse +--- +[ + TokenReference( + token: Token( + span: Span( + start: 0, + end: 10, + ), + kind: InterpolatedStringHead, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 10, + end: 15, + ), + kind: False, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 15, + end: 16, + ), + kind: RCurly, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 16, + end: 17, + ), + kind: Undetermined, + ), + leading_trivia: [], + trailing_trivia: [ + Token( + span: Span( + start: 17, + end: 18, + ), + kind: Whitespace, + ), + ], + ), + TokenReference( + token: Token( + span: Span( + start: 18, + end: 23, + ), + kind: Identifier, + ), + leading_trivia: [], + trailing_trivia: [], + ), + TokenReference( + token: Token( + span: Span( + start: 23, + end: 25, + ), + kind: StringLiteral, + ), + leading_trivia: [], + trailing_trivia: [], + ), +]