-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(parser): add some number literal pass cases.
- Loading branch information
Showing
18 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-01/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-01/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 4, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 3, | ||
), | ||
raw: Atom("123"), | ||
value: 123.0, | ||
kind: Decimal, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-01/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
123 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-01/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/panic/number-literal-01/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 3, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 3, | ||
end: 4, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-02/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-02/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 5, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 4, | ||
), | ||
raw: Atom("1.23"), | ||
value: 1.23, | ||
kind: Float, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-02/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.23 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-02/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-02/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 4, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 4, | ||
end: 5, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-03/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-03/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 6, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 5, | ||
), | ||
raw: Atom("1.2e3"), | ||
value: 1200.0, | ||
kind: Float, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-03/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.2e3 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-03/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-03/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 5, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 5, | ||
end: 6, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-04/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-04/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 7, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 6, | ||
), | ||
raw: Atom("1.2e+3"), | ||
value: 1200.0, | ||
kind: Float, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-04/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.2e+3 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-04/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-04/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 6, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 6, | ||
end: 7, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-05/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-05/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 7, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 6, | ||
), | ||
raw: Atom("1.2e-3"), | ||
value: 0.0012, | ||
kind: Float, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-05/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.2e-3 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-05/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-05/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 6, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 6, | ||
end: 7, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
crates/fuse-parser/tests/cases/pass/number-literal-06/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: parsed.chunk | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-06/case.fuse | ||
--- | ||
Some(Chunk( | ||
span: Span( | ||
start: 0, | ||
end: 8, | ||
), | ||
body: Block( | ||
statements: [ | ||
Expression(NumberLiteral(NumberLiteral( | ||
span: Span( | ||
start: 0, | ||
end: 7, | ||
), | ||
raw: Atom("123_456"), | ||
value: 123456.0, | ||
kind: Decimal, | ||
))), | ||
], | ||
), | ||
)) |
1 change: 1 addition & 0 deletions
1
crates/fuse-parser/tests/cases/pass/number-literal-06/case.fuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
123_456 |
26 changes: 26 additions & 0 deletions
26
crates/fuse-parser/tests/cases/pass/number-literal-06/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/fuse-parser/tests/cases/mod.rs | ||
expression: tokens | ||
input_file: crates/fuse-parser/tests/cases/pass/number-literal-06/case.fuse | ||
--- | ||
[ | ||
TokenReference( | ||
token: Token( | ||
span: Span( | ||
start: 0, | ||
end: 7, | ||
), | ||
kind: NumberLiteral, | ||
), | ||
leading_trivia: [], | ||
trailing_trivia: [ | ||
Token( | ||
span: Span( | ||
start: 7, | ||
end: 8, | ||
), | ||
kind: Whitespace, | ||
), | ||
], | ||
), | ||
] |