forked from argotorg/fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntax_node.rs
More file actions
123 lines (110 loc) · 3.18 KB
/
Copy pathsyntax_node.rs
File metadata and controls
123 lines (110 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use dir_test::{dir_test, Fixture};
use fe_compiler_test_utils::snap_test;
mod test_runner;
use test_runner::*;
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/items",
glob: "*.fe"
)]
fn test_item_list(fixture: Fixture<&str>) {
let runner = TestRunner::item_list(true);
let node = format! {"{:#?}", runner.run(fixture.content())};
snap_test!(node, fixture.path());
}
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/structs",
glob: "*.fe"
)]
fn test_struct(fixture: Fixture<&str>) {
let runner = TestRunner::item_list(true);
let node = format! {"{:#?}", runner.run(fixture.content())};
snap_test!(node, fixture.path());
}
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/stmts",
glob: "*.fe"
)]
fn test_stmt(fixture: Fixture<&str>) {
let runner = TestRunner::stmt_list(true);
let node = format! {"{:#?}", runner.run(fixture.content())};
snap_test!(node, fixture.path());
}
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/exprs",
glob: "*.fe"
postfix: "expr"
)]
fn test_expr(fixture: Fixture<&str>) {
let runner = TestRunner::expr_list(true);
let node = format! {"{:#?}", runner.run(fixture.content())};
snap_test!(node, fixture.path());
}
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/pats",
glob: "*.fe"
)]
fn test_pat(fixture: Fixture<&str>) {
let runner = TestRunner::pat_list(true);
let node = format! {"{:#?}", runner.run(fixture.content())};
snap_test!(node, fixture.path());
}
#[cfg(target_family = "wasm")]
mod wasm {
use super::*;
use wasm_bindgen_test::wasm_bindgen_test;
#[dir_test::dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/items",
glob: "*.fe"
postfix: "wasm"
)]
#[dir_test_attr(
#[wasm_bindgen_test]
)]
fn test_item_list(fixture: dir_test::Fixture<&str>) {
TestRunner::item_list(true).run(fixture.content());
}
#[dir_test::dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/structs",
glob: "*.fe"
postfix: "wasm"
)]
#[dir_test_attr(
#[wasm_bindgen_test]
)]
fn test_struct(fixture: dir_test::Fixture<&str>) {
TestRunner::item_list(true).run(fixture.content());
}
#[dir_test::dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/stmts",
glob: "*.fe"
postfix: "wasm"
)]
#[dir_test_attr(
#[wasm_bindgen_test]
)]
fn test_stmt(fixture: dir_test::Fixture<&str>) {
TestRunner::stmt_list(true).run(fixture.content());
}
#[dir_test::dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/exprs",
glob: "*.fe"
postfix: "wasm"
)]
#[dir_test_attr(
#[wasm_bindgen_test]
)]
fn test_expr(fixture: dir_test::Fixture<&str>) {
TestRunner::expr_list(true).run(fixture.content());
}
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node/pats",
glob: "*.fe"
postfix: "wasm"
)]
#[dir_test_attr(
#[wasm_bindgen_test]
)]
fn test_pat(fixture: Fixture<&str>) {
TestRunner::pat_list(true).run(fixture.content());
}
}