aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/call_hierarchy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/call_hierarchy.rs')
-rw-r--r--crates/ra_ide/src/call_hierarchy.rs172
1 files changed, 86 insertions, 86 deletions
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index defd8176f..1e3a31602 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -145,12 +145,12 @@ mod tests {
145 use crate::mock_analysis::analysis_and_position; 145 use crate::mock_analysis::analysis_and_position;
146 146
147 fn check_hierarchy( 147 fn check_hierarchy(
148 fixture: &str, 148 ra_fixture: &str,
149 expected: &str, 149 expected: &str,
150 expected_incoming: &[&str], 150 expected_incoming: &[&str],
151 expected_outgoing: &[&str], 151 expected_outgoing: &[&str],
152 ) { 152 ) {
153 let (analysis, pos) = analysis_and_position(fixture); 153 let (analysis, pos) = analysis_and_position(ra_fixture);
154 154
155 let mut navs = analysis.call_hierarchy(pos).unwrap().unwrap().info; 155 let mut navs = analysis.call_hierarchy(pos).unwrap().unwrap().info;
156 assert_eq!(navs.len(), 1); 156 assert_eq!(navs.len(), 1);
@@ -177,12 +177,12 @@ mod tests {
177 fn test_call_hierarchy_on_ref() { 177 fn test_call_hierarchy_on_ref() {
178 check_hierarchy( 178 check_hierarchy(
179 r#" 179 r#"
180 //- /lib.rs 180//- /lib.rs
181 fn callee() {} 181fn callee() {}
182 fn caller() { 182fn caller() {
183 call<|>ee(); 183 call<|>ee();
184 } 184}
185 "#, 185"#,
186 "callee FN_DEF FileId(1) 0..14 3..9", 186 "callee FN_DEF FileId(1) 0..14 3..9",
187 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], 187 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"],
188 &[], 188 &[],
@@ -193,12 +193,12 @@ mod tests {
193 fn test_call_hierarchy_on_def() { 193 fn test_call_hierarchy_on_def() {
194 check_hierarchy( 194 check_hierarchy(
195 r#" 195 r#"
196 //- /lib.rs 196//- /lib.rs
197 fn call<|>ee() {} 197fn call<|>ee() {}
198 fn caller() { 198fn caller() {
199 callee(); 199 callee();
200 } 200}
201 "#, 201"#,
202 "callee FN_DEF FileId(1) 0..14 3..9", 202 "callee FN_DEF FileId(1) 0..14 3..9",
203 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], 203 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"],
204 &[], 204 &[],
@@ -209,13 +209,13 @@ mod tests {
209 fn test_call_hierarchy_in_same_fn() { 209 fn test_call_hierarchy_in_same_fn() {
210 check_hierarchy( 210 check_hierarchy(
211 r#" 211 r#"
212 //- /lib.rs 212//- /lib.rs
213 fn callee() {} 213fn callee() {}
214 fn caller() { 214fn caller() {
215 call<|>ee(); 215 call<|>ee();
216 callee(); 216 callee();
217 } 217}
218 "#, 218"#,
219 "callee FN_DEF FileId(1) 0..14 3..9", 219 "callee FN_DEF FileId(1) 0..14 3..9",
220 &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], 220 &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"],
221 &[], 221 &[],
@@ -226,20 +226,20 @@ mod tests {
226 fn test_call_hierarchy_in_different_fn() { 226 fn test_call_hierarchy_in_different_fn() {
227 check_hierarchy( 227 check_hierarchy(
228 r#" 228 r#"
229 //- /lib.rs 229//- /lib.rs
230 fn callee() {} 230fn callee() {}
231 fn caller1() { 231fn caller1() {
232 call<|>ee(); 232 call<|>ee();
233 } 233}
234 234
235 fn caller2() { 235fn caller2() {
236 callee(); 236 callee();
237 } 237}
238 "#, 238"#,
239 "callee FN_DEF FileId(1) 0..14 3..9", 239 "callee FN_DEF FileId(1) 0..14 3..9",
240 &[ 240 &[
241 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", 241 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]",
242 "caller2 FN_DEF FileId(1) 46..76 49..56 : [65..71]", 242 "caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]",
243 ], 243 ],
244 &[], 244 &[],
245 ); 245 );
@@ -249,26 +249,26 @@ mod tests {
249 fn test_call_hierarchy_in_tests_mod() { 249 fn test_call_hierarchy_in_tests_mod() {
250 check_hierarchy( 250 check_hierarchy(
251 r#" 251 r#"
252 //- /lib.rs cfg:test 252//- /lib.rs cfg:test
253 fn callee() {} 253fn callee() {}
254 fn caller1() { 254fn caller1() {
255 call<|>ee(); 255 call<|>ee();
256 } 256}
257 257
258 #[cfg(test)] 258#[cfg(test)]
259 mod tests { 259mod tests {
260 use super::*; 260 use super::*;
261 261
262 #[test] 262 #[test]
263 fn test_caller() { 263 fn test_caller() {
264 callee(); 264 callee();
265 } 265 }
266 } 266}
267 "#, 267"#,
268 "callee FN_DEF FileId(1) 0..14 3..9", 268 "callee FN_DEF FileId(1) 0..14 3..9",
269 &[ 269 &[
270 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", 270 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]",
271 "test_caller FN_DEF FileId(1) 93..147 108..119 : [132..138]", 271 "test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]",
272 ], 272 ],
273 &[], 273 &[],
274 ); 274 );
@@ -278,19 +278,19 @@ mod tests {
278 fn test_call_hierarchy_in_different_files() { 278 fn test_call_hierarchy_in_different_files() {
279 check_hierarchy( 279 check_hierarchy(
280 r#" 280 r#"
281 //- /lib.rs 281//- /lib.rs
282 mod foo; 282mod foo;
283 use foo::callee; 283use foo::callee;
284 284
285 fn caller() { 285fn caller() {
286 call<|>ee(); 286 call<|>ee();
287 } 287}
288 288
289 //- /foo/mod.rs 289//- /foo/mod.rs
290 pub fn callee() {} 290pub fn callee() {}
291 "#, 291"#,
292 "callee FN_DEF FileId(2) 0..18 7..13", 292 "callee FN_DEF FileId(2) 0..18 7..13",
293 &["caller FN_DEF FileId(1) 26..55 29..35 : [44..50]"], 293 &["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"],
294 &[], 294 &[],
295 ); 295 );
296 } 296 }
@@ -299,13 +299,13 @@ mod tests {
299 fn test_call_hierarchy_outgoing() { 299 fn test_call_hierarchy_outgoing() {
300 check_hierarchy( 300 check_hierarchy(
301 r#" 301 r#"
302 //- /lib.rs 302//- /lib.rs
303 fn callee() {} 303fn callee() {}
304 fn call<|>er() { 304fn call<|>er() {
305 callee(); 305 callee();
306 callee(); 306 callee();
307 } 307}
308 "#, 308"#,
309 "caller FN_DEF FileId(1) 15..58 18..24", 309 "caller FN_DEF FileId(1) 15..58 18..24",
310 &[], 310 &[],
311 &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], 311 &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"],
@@ -316,20 +316,20 @@ mod tests {
316 fn test_call_hierarchy_outgoing_in_different_files() { 316 fn test_call_hierarchy_outgoing_in_different_files() {
317 check_hierarchy( 317 check_hierarchy(
318 r#" 318 r#"
319 //- /lib.rs 319//- /lib.rs
320 mod foo; 320mod foo;
321 use foo::callee; 321use foo::callee;
322 322
323 fn call<|>er() { 323fn call<|>er() {
324 callee(); 324 callee();
325 } 325}
326 326
327 //- /foo/mod.rs 327//- /foo/mod.rs
328 pub fn callee() {} 328pub fn callee() {}
329 "#, 329"#,
330 "caller FN_DEF FileId(1) 26..55 29..35", 330 "caller FN_DEF FileId(1) 27..56 30..36",
331 &[], 331 &[],
332 &["callee FN_DEF FileId(2) 0..18 7..13 : [44..50]"], 332 &["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"],
333 ); 333 );
334 } 334 }
335 335
@@ -337,22 +337,22 @@ mod tests {
337 fn test_call_hierarchy_incoming_outgoing() { 337 fn test_call_hierarchy_incoming_outgoing() {
338 check_hierarchy( 338 check_hierarchy(
339 r#" 339 r#"
340 //- /lib.rs 340//- /lib.rs
341 fn caller1() { 341fn caller1() {
342 call<|>er2(); 342 call<|>er2();
343 } 343}
344 344
345 fn caller2() { 345fn caller2() {
346 caller3(); 346 caller3();
347 } 347}
348 348
349 fn caller3() { 349fn caller3() {
350 350
351 } 351}
352 "#, 352"#,
353 "caller2 FN_DEF FileId(1) 32..63 35..42", 353 "caller2 FN_DEF FileId(1) 33..64 36..43",
354 &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], 354 &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"],
355 &["caller3 FN_DEF FileId(1) 64..80 67..74 : [51..58]"], 355 &["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"],
356 ); 356 );
357 } 357 }
358} 358}