aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/tests
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-05 11:10:20 +0000
committerAleksey Kladov <[email protected]>2018-11-05 11:10:20 +0000
commit6bbcfca7aec6408cf27415ae6f965adc472d6f18 (patch)
tree7b332c6db6e662ca31aafded143476d81a60453f /crates/ra_analysis/tests
parent44d891938493cc32efd2e44d81bc76cc3bc391c0 (diff)
Fully add inline modules to module tree
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}