feat: add first code snapshot test with insta

This commit is contained in:
Cainã Costa 2023-06-30 12:37:20 -03:00 committed by rvcas
parent 58c854fd3f
commit eeaa1a05d2
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
2 changed files with 35 additions and 0 deletions

View File

@ -23,6 +23,17 @@ fn assert_definitions(code: &str, definitions: Vec<ast::UntypedDefinition>) {
)
}
fn snapshot_test(code: &str) {
let (module, _) =
parser::module(code, ast::ModuleKind::Validator).expect("Failed to parse code");
insta::assert_debug_snapshot!(module);
}
#[test]
fn snapshot_windows_newline() {
snapshot_test("use aiken/list\r\n")
}
#[test]
fn windows_newline() {
let code = "use aiken/list\r\n";

View File

@ -0,0 +1,24 @@
---
source: crates/aiken-lang/src/tests/parser.rs
expression: module
---
Module {
name: "",
docs: [],
type_info: (),
definitions: [
Use(
Use {
as_name: None,
location: 0..14,
module: [
"aiken",
"list",
],
package: (),
unqualified: [],
},
),
],
kind: Validator,
}