aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/tests')
-rw-r--r--crates/ra_analysis/tests/tests.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs
index c2754c8e4..7f7bb8e6b 100644
--- a/crates/ra_analysis/tests/tests.rs
+++ b/crates/ra_analysis/tests/tests.rs
@@ -92,9 +92,28 @@ fn test_resolve_parent_module() {
92 <|>// empty 92 <|>// empty
93 ", 93 ",
94 ); 94 );
95 let symbols = analysis.parent_module(pos.file_id).unwrap(); 95 let symbols = analysis.parent_module(pos.file_id, pos.offset).unwrap();
96 assert_eq_dbg( 96 assert_eq_dbg(
97 r#"[(FileId(1), FileSymbol { name: "foo", node_range: [0; 8), kind: MODULE })]"#, 97 r#"[(FileId(1), FileSymbol { name: "foo", node_range: [4; 7), kind: MODULE })]"#,
98 &symbols,
99 );
100}
101
102#[test]
103fn test_resolve_parent_module_for_inline() {
104 let (analysis, pos) = analysis_and_position(
105 "
106 //- /lib.rs
107 mod foo {
108 mod bar {
109 mod baz { <|> }
110 }
111 }
112 ",
113 );
114 let symbols = analysis.parent_module(pos.file_id, pos.offset).unwrap();
115 assert_eq_dbg(
116 r#"[(FileId(1), FileSymbol { name: "bar", node_range: [18; 21), kind: MODULE })]"#,
98 &symbols, 117 &symbols,
99 ); 118 );
100} 119}