diff options
author | Aleksey Kladov <[email protected]> | 2018-08-14 09:20:09 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-14 09:20:09 +0100 |
commit | 2b828c68e8acda628d6e3a36827d1ffd9c9aaec6 (patch) | |
tree | e63ec3bb469eaaf996bbc45c038e66395c04ed23 /crates/libeditor/tests | |
parent | 49ab44102496ac8c4a05b00c584adecf583f4d87 (diff) |
separete structure from symbols
Diffstat (limited to 'crates/libeditor/tests')
-rw-r--r-- | crates/libeditor/tests/test.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/libeditor/tests/test.rs b/crates/libeditor/tests/test.rs index fab2e4ad3..97fa30e1f 100644 --- a/crates/libeditor/tests/test.rs +++ b/crates/libeditor/tests/test.rs | |||
@@ -9,7 +9,7 @@ use itertools::Itertools; | |||
9 | use libsyntax2::AstNode; | 9 | use libsyntax2::AstNode; |
10 | use libeditor::{ | 10 | use libeditor::{ |
11 | File, TextUnit, TextRange, | 11 | File, TextUnit, TextRange, |
12 | highlight, runnables, extend_selection, file_symbols, flip_comma, | 12 | highlight, runnables, extend_selection, file_structure, flip_comma, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #[test] | 15 | #[test] |
@@ -66,7 +66,7 @@ fn test_foo() {} | |||
66 | } | 66 | } |
67 | 67 | ||
68 | #[test] | 68 | #[test] |
69 | fn symbols() { | 69 | fn test_structure() { |
70 | let file = file(r#" | 70 | let file = file(r#" |
71 | struct Foo { | 71 | struct Foo { |
72 | x: i32 | 72 | x: i32 |
@@ -80,16 +80,22 @@ enum E { X, Y(i32) } | |||
80 | type T = (); | 80 | type T = (); |
81 | static S: i32 = 92; | 81 | static S: i32 = 92; |
82 | const C: i32 = 92; | 82 | const C: i32 = 92; |
83 | |||
84 | impl E {} | ||
85 | |||
86 | impl fmt::Debug for E {} | ||
83 | "#); | 87 | "#); |
84 | let symbols = file_symbols(&file); | 88 | let symbols = file_structure(&file); |
85 | dbg_eq( | 89 | dbg_eq( |
86 | r#"[FileSymbol { parent: None, name: "Foo", name_range: [8; 11), node_range: [1; 26), kind: STRUCT_DEF }, | 90 | r#"[StructureNode { parent: None, label: "Foo", navigation_range: [8; 11), node_range: [1; 26), kind: STRUCT_DEF }, |
87 | FileSymbol { parent: None, name: "m", name_range: [32; 33), node_range: [28; 53), kind: MODULE }, | 91 | StructureNode { parent: None, label: "m", navigation_range: [32; 33), node_range: [28; 53), kind: MODULE }, |
88 | FileSymbol { parent: Some(1), name: "bar", name_range: [43; 46), node_range: [40; 51), kind: FN_DEF }, | 92 | StructureNode { parent: Some(1), label: "bar", navigation_range: [43; 46), node_range: [40; 51), kind: FN_DEF }, |
89 | FileSymbol { parent: None, name: "E", name_range: [60; 61), node_range: [55; 75), kind: ENUM_DEF }, | 93 | StructureNode { parent: None, label: "E", navigation_range: [60; 61), node_range: [55; 75), kind: ENUM_DEF }, |
90 | FileSymbol { parent: None, name: "T", name_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF }, | 94 | StructureNode { parent: None, label: "T", navigation_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF }, |
91 | FileSymbol { parent: None, name: "S", name_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF }, | 95 | StructureNode { parent: None, label: "S", navigation_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF }, |
92 | FileSymbol { parent: None, name: "C", name_range: [115; 116), node_range: [109; 127), kind: CONST_DEF }]"#, | 96 | StructureNode { parent: None, label: "C", navigation_range: [115; 116), node_range: [109; 127), kind: CONST_DEF }, |
97 | StructureNode { parent: None, label: "impl E ", navigation_range: [129; 136), node_range: [129; 138), kind: IMPL_ITEM }, | ||
98 | StructureNode { parent: None, label: "impl fmt::Debug for E ", navigation_range: [140; 162), node_range: [140; 164), kind: IMPL_ITEM }]"#, | ||
93 | &symbols, | 99 | &symbols, |
94 | ) | 100 | ) |
95 | } | 101 | } |