diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-05 11:12:04 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-05 11:12:04 +0000 |
commit | de9bb9cfefb6d19958363f7d064aef6adbca9107 (patch) | |
tree | 7b332c6db6e662ca31aafded143476d81a60453f /crates/ra_analysis/tests | |
parent | 6502bd2c966d57bdb8fbba7f43da9ddd004d87d3 (diff) | |
parent | 6bbcfca7aec6408cf27415ae6f965adc472d6f18 (diff) |
Merge #193
193: Inline modules r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/tests')
-rw-r--r-- | crates/ra_analysis/tests/tests.rs | 23 |
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] | ||
103 | fn 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 | } |