feat: add first code snapshot test with insta
This commit is contained in:
parent
58c854fd3f
commit
eeaa1a05d2
|
@ -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";
|
||||
|
|
|
@ -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,
|
||||
}
|
Loading…
Reference in New Issue