Use insta to verify values.

This commit is contained in:
DimitrisJim 2023-02-25 13:35:22 +02:00 committed by Jeong YunWon
parent d7e2e7361e
commit 8f425e9ce2
9 changed files with 344 additions and 0 deletions

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 15,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 15,
},
),
custom: (),
node: Constant {
value: Str(
"\u{8}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 9,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 9,
},
),
custom: (),
node: Constant {
value: Str(
"\u{7}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 21,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 21,
},
),
custom: (),
node: Constant {
value: Str(
"\r",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 45,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 45,
},
),
custom: (),
node: Constant {
value: Str(
"\u{89}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 12,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 12,
},
),
custom: (),
node: Constant {
value: Str(
"\u{7f}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 12,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 12,
},
),
custom: (),
node: Constant {
value: Str(
"\u{1b}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 15,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 15,
},
),
custom: (),
node: Constant {
value: Str(
"\u{c}",
),
kind: None,
},
},
},
},
]

View file

@ -0,0 +1,40 @@
---
source: compiler/parser/src/string.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 9,
},
),
custom: (),
node: Expr {
value: Located {
location: Location {
row: 1,
column: 0,
},
end_location: Some(
Location {
row: 1,
column: 9,
},
),
custom: (),
node: Constant {
value: Str(
"\u{88}",
),
kind: None,
},
},
},
},
]

View file

@ -1048,4 +1048,28 @@ mod tests {
let parse_ast = parse_program(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
}
macro_rules! test_aliases_parse {
($($name:ident: $alias:expr,)*) => {
$(
#[test]
fn $name() {
let source = format!(r#""\N{{{0}}}""#, $alias);
let parse_ast = parse_program(&source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
}
)*
}
}
test_aliases_parse! {
test_backspace_alias: "BACKSPACE",
test_bell_alias: "BEL",
test_carriage_return_alias: "CARRIAGE RETURN",
test_delete_alias: "DELETE",
test_escape_alias: "ESCAPE",
test_form_feed_alias: "FORM FEED",
test_hts_alias: "HTS",
test_character_tabulation_with_justification_alias: "CHARACTER TABULATION WITH JUSTIFICATION",
}
}