Skip to content

Commit 8f425e9

Browse files
DimitrisJimyouknowone
authored andcommitted
Use insta to verify values.
1 parent d7e2e73 commit 8f425e9

9 files changed

Lines changed: 344 additions & 0 deletions
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 15,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 15,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{8}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 9,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 9,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{7}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 21,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 21,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\r",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 45,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 45,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{89}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 12,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 12,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{7f}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 12,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 12,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{1b}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 15,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 15,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{c}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
source: compiler/parser/src/string.rs
3+
expression: parse_ast
4+
---
5+
[
6+
Located {
7+
location: Location {
8+
row: 1,
9+
column: 0,
10+
},
11+
end_location: Some(
12+
Location {
13+
row: 1,
14+
column: 9,
15+
},
16+
),
17+
custom: (),
18+
node: Expr {
19+
value: Located {
20+
location: Location {
21+
row: 1,
22+
column: 0,
23+
},
24+
end_location: Some(
25+
Location {
26+
row: 1,
27+
column: 9,
28+
},
29+
),
30+
custom: (),
31+
node: Constant {
32+
value: Str(
33+
"\u{88}",
34+
),
35+
kind: None,
36+
},
37+
},
38+
},
39+
},
40+
]

‎parser/src/string.rs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,4 +1048,28 @@ mod tests {
10481048
let parse_ast = parse_program(source, "<test>").unwrap();
10491049
insta::assert_debug_snapshot!(parse_ast);
10501050
}
1051+
1052+
macro_rules! test_aliases_parse {
1053+
($($name:ident: $alias:expr,)*) => {
1054+
$(
1055+
#[test]
1056+
fn $name() {
1057+
let source = format!(r#""\N{{{0}}}""#, $alias);
1058+
let parse_ast = parse_program(&source, "<test>").unwrap();
1059+
insta::assert_debug_snapshot!(parse_ast);
1060+
}
1061+
)*
1062+
}
1063+
}
1064+
1065+
test_aliases_parse! {
1066+
test_backspace_alias: "BACKSPACE",
1067+
test_bell_alias: "BEL",
1068+
test_carriage_return_alias: "CARRIAGE RETURN",
1069+
test_delete_alias: "DELETE",
1070+
test_escape_alias: "ESCAPE",
1071+
test_form_feed_alias: "FORM FEED",
1072+
test_hts_alias: "HTS",
1073+
test_character_tabulation_with_justification_alias: "CHARACTER TABULATION WITH JUSTIFICATION",
1074+
}
10511075
}

0 commit comments

Comments
 (0)