Skip to content

Commit 6f6b7b2

Browse files
committed
add tests
1 parent 93cb05e commit 6f6b7b2

3 files changed

Lines changed: 126 additions & 0 deletions

File tree

‎parser/src/parser.rs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,18 @@ class Foo(A, B):
218218
let parse_ast = parse_expression(&source, "<test>").unwrap();
219219
insta::assert_debug_snapshot!(parse_ast);
220220
}
221+
222+
#[test]
223+
fn test_parse_boolop_or() {
224+
let source = String::from("x or y");
225+
let parse_ast = parse_expression(&source, "<test>").unwrap();
226+
insta::assert_debug_snapshot!(parse_ast);
227+
}
228+
229+
#[test]
230+
fn test_parse_boolop_and() {
231+
let source = String::from("x and y");
232+
let parse_ast = parse_expression(&source, "<test>").unwrap();
233+
insta::assert_debug_snapshot!(parse_ast);
234+
}
221235
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
source: compiler/parser/src/parser.rs
3+
expression: parse_ast
4+
---
5+
Located {
6+
location: Location {
7+
row: 1,
8+
column: 0,
9+
},
10+
end_location: Some(
11+
Location {
12+
row: 1,
13+
column: 7,
14+
},
15+
),
16+
custom: (),
17+
node: BoolOp {
18+
op: And,
19+
values: [
20+
Located {
21+
location: Location {
22+
row: 1,
23+
column: 0,
24+
},
25+
end_location: Some(
26+
Location {
27+
row: 1,
28+
column: 1,
29+
},
30+
),
31+
custom: (),
32+
node: Name {
33+
id: "x",
34+
ctx: Load,
35+
},
36+
},
37+
Located {
38+
location: Location {
39+
row: 1,
40+
column: 6,
41+
},
42+
end_location: Some(
43+
Location {
44+
row: 1,
45+
column: 7,
46+
},
47+
),
48+
custom: (),
49+
node: Name {
50+
id: "y",
51+
ctx: Load,
52+
},
53+
},
54+
],
55+
},
56+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
source: compiler/parser/src/parser.rs
3+
expression: parse_ast
4+
---
5+
Located {
6+
location: Location {
7+
row: 1,
8+
column: 0,
9+
},
10+
end_location: Some(
11+
Location {
12+
row: 1,
13+
column: 6,
14+
},
15+
),
16+
custom: (),
17+
node: BoolOp {
18+
op: Or,
19+
values: [
20+
Located {
21+
location: Location {
22+
row: 1,
23+
column: 0,
24+
},
25+
end_location: Some(
26+
Location {
27+
row: 1,
28+
column: 1,
29+
},
30+
),
31+
custom: (),
32+
node: Name {
33+
id: "x",
34+
ctx: Load,
35+
},
36+
},
37+
Located {
38+
location: Location {
39+
row: 1,
40+
column: 5,
41+
},
42+
end_location: Some(
43+
Location {
44+
row: 1,
45+
column: 6,
46+
},
47+
),
48+
custom: (),
49+
node: Name {
50+
id: "y",
51+
ctx: Load,
52+
},
53+
},
54+
],
55+
},
56+
}

0 commit comments

Comments
 (0)