-
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(ast): add snapshot tests and tooling
Co-authored-by: Samyak S Sarnayak <[email protected]>
- Loading branch information
Showing
18 changed files
with
2,163 additions
and
7 deletions.
There are no files selected for viewing
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
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 @@ | ||
func main() {}; |
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
func main() { | ||
/* */ | ||
|
||
/**/ | ||
|
||
/* hey there */ | ||
|
||
/*hey there*/ | ||
|
||
/*bakugo*/ | ||
|
||
/* | ||
|
||
*/ | ||
|
||
/* | ||
*/ | ||
|
||
/* | ||
bakugo | ||
*/ | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
func expr(int) { | ||
func expr() { | ||
-4 + 2 * 3; | ||
4 & 3 | 1; | ||
4; | ||
|
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,2 @@ | ||
func expr(int) { | ||
}; |
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
29 changes: 29 additions & 0 deletions
29
compiler/tests/snapshots/parser__ast@01_empty_main.bakugo.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,29 @@ | ||
--- | ||
source: tests/parser.rs | ||
expression: parsed | ||
input_file: tests/examples/01_empty_main.bakugo | ||
--- | ||
SourceFile { | ||
top_level: [ | ||
FnDecl( | ||
FnDecl { | ||
name: Ident { | ||
value: "main", | ||
span: Span { | ||
str: "main", | ||
start: 5, | ||
end: 9, | ||
}, | ||
}, | ||
params: [], | ||
result_kind: None, | ||
body: [], | ||
span: Span { | ||
str: "func main() {}", | ||
start: 0, | ||
end: 14, | ||
}, | ||
}, | ||
), | ||
], | ||
} |
29 changes: 29 additions & 0 deletions
29
compiler/tests/snapshots/parser__ast@02_comments.bakugo.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,29 @@ | ||
--- | ||
source: tests/parser.rs | ||
expression: parsed | ||
input_file: tests/examples/02_comments.bakugo | ||
--- | ||
SourceFile { | ||
top_level: [ | ||
FnDecl( | ||
FnDecl { | ||
name: Ident { | ||
value: "main", | ||
span: Span { | ||
str: "main", | ||
start: 5, | ||
end: 9, | ||
}, | ||
}, | ||
params: [], | ||
result_kind: None, | ||
body: [], | ||
span: Span { | ||
str: "func main() {\n\t/* */\n\n\t/**/\n\n\t/* hey there */\n\n\t/*hey there*/\n\n\t/*bakugo*/\n\n\t/*\n\n\t*/\n\n\t/*\n\t*/\n\n\t/*\n\t\tbakugo\n\t*/\n}", | ||
start: 0, | ||
end: 114, | ||
}, | ||
}, | ||
), | ||
], | ||
} |
Oops, something went wrong.