From 2b828c68e8acda628d6e3a36827d1ffd9c9aaec6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 14 Aug 2018 11:20:09 +0300 Subject: separete structure from symbols --- crates/libeditor/tests/test.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'crates/libeditor/tests') 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; use libsyntax2::AstNode; use libeditor::{ File, TextUnit, TextRange, - highlight, runnables, extend_selection, file_symbols, flip_comma, + highlight, runnables, extend_selection, file_structure, flip_comma, }; #[test] @@ -66,7 +66,7 @@ fn test_foo() {} } #[test] -fn symbols() { +fn test_structure() { let file = file(r#" struct Foo { x: i32 @@ -80,16 +80,22 @@ enum E { X, Y(i32) } type T = (); static S: i32 = 92; const C: i32 = 92; + +impl E {} + +impl fmt::Debug for E {} "#); - let symbols = file_symbols(&file); + let symbols = file_structure(&file); dbg_eq( - r#"[FileSymbol { parent: None, name: "Foo", name_range: [8; 11), node_range: [1; 26), kind: STRUCT_DEF }, - FileSymbol { parent: None, name: "m", name_range: [32; 33), node_range: [28; 53), kind: MODULE }, - FileSymbol { parent: Some(1), name: "bar", name_range: [43; 46), node_range: [40; 51), kind: FN_DEF }, - FileSymbol { parent: None, name: "E", name_range: [60; 61), node_range: [55; 75), kind: ENUM_DEF }, - FileSymbol { parent: None, name: "T", name_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF }, - FileSymbol { parent: None, name: "S", name_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF }, - FileSymbol { parent: None, name: "C", name_range: [115; 116), node_range: [109; 127), kind: CONST_DEF }]"#, + r#"[StructureNode { parent: None, label: "Foo", navigation_range: [8; 11), node_range: [1; 26), kind: STRUCT_DEF }, + StructureNode { parent: None, label: "m", navigation_range: [32; 33), node_range: [28; 53), kind: MODULE }, + StructureNode { parent: Some(1), label: "bar", navigation_range: [43; 46), node_range: [40; 51), kind: FN_DEF }, + StructureNode { parent: None, label: "E", navigation_range: [60; 61), node_range: [55; 75), kind: ENUM_DEF }, + StructureNode { parent: None, label: "T", navigation_range: [81; 82), node_range: [76; 88), kind: TYPE_DEF }, + StructureNode { parent: None, label: "S", navigation_range: [96; 97), node_range: [89; 108), kind: STATIC_DEF }, + StructureNode { parent: None, label: "C", navigation_range: [115; 116), node_range: [109; 127), kind: CONST_DEF }, + StructureNode { parent: None, label: "impl E ", navigation_range: [129; 136), node_range: [129; 138), kind: IMPL_ITEM }, + StructureNode { parent: None, label: "impl fmt::Debug for E ", navigation_range: [140; 162), node_range: [140; 164), kind: IMPL_ITEM }]"#, &symbols, ) } -- cgit v1.2.3