Skip to content

Commit 11b4dee

Browse files
committed
Simplify snapshot test output for export index
1 parent 6636847 commit 11b4dee

File tree

3 files changed

+86
-299
lines changed

3 files changed

+86
-299
lines changed

crates/indexing/tests/indexing.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,33 @@ fn type_role_errors() {
203203

204204
#[test]
205205
fn index_export() {
206-
let (_, index, errors) = index_source(
206+
let (_, index, _) = index_source(
207207
"module Main (life, class Eq, Synonym, Data(..), (+), type (+), module Export) where\n",
208208
);
209209

210-
insta::assert_debug_snapshot!((index, errors));
210+
let life = index.export.lookup_expr_export("life");
211+
let eq_class = index.export.lookup_type_export("Eq");
212+
let synonym = index.export.lookup_type_export("Synonym");
213+
let data = index.export.lookup_type_export("Data");
214+
let plus = index.export.lookup_expr_export("(+)");
215+
let plus_type = index.export.lookup_type_export("(+)");
216+
let export = index.export.lookup_module_export("Export");
217+
218+
let mut snapshot = String::default();
219+
writeln!(snapshot, "life: {:?}", life).unwrap();
220+
writeln!(snapshot, "eq_class: {:?}", eq_class).unwrap();
221+
writeln!(snapshot, "synonym: {:?}", synonym).unwrap();
222+
writeln!(snapshot, "data: {:?}", data).unwrap();
223+
writeln!(snapshot, "plus: {:?}", plus).unwrap();
224+
writeln!(snapshot, "plus_type: {:?}", plus_type).unwrap();
225+
writeln!(snapshot, "export: {:?}", export).unwrap();
226+
insta::assert_snapshot!(snapshot);
211227
}
212228

213229
#[test]
214230
fn index_export_duplicate() {
215-
let (_, index, errors) = index_source(
231+
let (_, _, errors) = index_source(
216232
"module Main (life, life, class Eq, class Eq, Synonym, Synonym, Data(..), Data(..), (+), (+), type (+), type (+), module Export, module Export)"
217233
);
218-
219-
insta::assert_debug_snapshot!((index, errors));
234+
insta::assert_debug_snapshot!(errors);
220235
}
Lines changed: 8 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,12 @@
11
---
22
source: crates/indexing/tests/indexing.rs
3-
expression: "(index, errors)"
3+
expression: snapshot
44
snapshot_kind: text
55
---
6-
(
7-
IndexingResult {
8-
source_map: SourceMap {
9-
exports: {
10-
AstPtr {
11-
raw: SyntaxNodePtr {
12-
kind: ExportValue,
13-
range: 13..17,
14-
},
15-
},
16-
AstPtr {
17-
raw: SyntaxNodePtr {
18-
kind: ExportClass,
19-
range: 18..27,
20-
},
21-
},
22-
AstPtr {
23-
raw: SyntaxNodePtr {
24-
kind: ExportType,
25-
range: 28..36,
26-
},
27-
},
28-
AstPtr {
29-
raw: SyntaxNodePtr {
30-
kind: ExportType,
31-
range: 37..46,
32-
},
33-
},
34-
AstPtr {
35-
raw: SyntaxNodePtr {
36-
kind: ExportOperator,
37-
range: 47..51,
38-
},
39-
},
40-
AstPtr {
41-
raw: SyntaxNodePtr {
42-
kind: ExportTypeOperator,
43-
range: 52..61,
44-
},
45-
},
46-
AstPtr {
47-
raw: SyntaxNodePtr {
48-
kind: ExportModule,
49-
range: 62..76,
50-
},
51-
},
52-
},
53-
imports: {},
54-
declaration: {},
55-
constructor: {},
56-
class_member: {},
57-
instance: {},
58-
instance_member: {},
59-
},
60-
nominal: NominalIndex {
61-
qualified: {},
62-
expr_item: {},
63-
type_item: {},
64-
},
65-
export: ExportIndex {
66-
module_export: {
67-
"Export": Id(
68-
6,
69-
),
70-
},
71-
expr_export: {
72-
"(+)": Id(
73-
4,
74-
),
75-
"life": Id(
76-
0,
77-
),
78-
},
79-
type_export: {
80-
"(+)": Id(
81-
5,
82-
),
83-
"Synonym": Id(
84-
2,
85-
),
86-
"Eq": Id(
87-
1,
88-
),
89-
"Data": Id(
90-
3,
91-
),
92-
},
93-
},
94-
relational: RelationalIndex {
95-
constructor_of: [],
96-
class_member_of: [],
97-
instance_of: [],
98-
instance_member_of: [],
99-
},
100-
},
101-
[],
102-
)
6+
life: Some(Id(0))
7+
eq_class: Some(Id(1))
8+
synonym: Some(Id(2))
9+
data: Some(Id(3))
10+
plus: Some(Id(4))
11+
plus_type: Some(Id(5))
12+
export: Some(Id(6))

0 commit comments

Comments
 (0)