diff options
author | Edwin Cheng <[email protected]> | 2019-11-03 17:49:49 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-11-04 17:38:20 +0000 |
commit | 1630a34c3f5c8b1ae2b4e1a99a918fd4d4ec52aa (patch) | |
tree | e49093cad909ca1ced61d839317f96132137c440 /crates/ra_ide_api | |
parent | e8741b9d75eb4edd711c6516c3b17c87c0431166 (diff) |
Add tests
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 97127706f..afa59cbe3 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -346,6 +346,46 @@ mod tests { | |||
346 | } | 346 | } |
347 | 347 | ||
348 | #[test] | 348 | #[test] |
349 | fn goto_definition_works_for_macro_defined_fn_with_arg() { | ||
350 | check_goto( | ||
351 | " | ||
352 | //- /lib.rs | ||
353 | macro_rules! define_fn { | ||
354 | ($name:ident) => (fn $name() {}) | ||
355 | } | ||
356 | |||
357 | define_fn!( | ||
358 | foo | ||
359 | ) | ||
360 | |||
361 | fn bar() { | ||
362 | <|>foo(); | ||
363 | } | ||
364 | ", | ||
365 | "foo FN_DEF FileId(1) [80; 83) [80; 83)", | ||
366 | ); | ||
367 | } | ||
368 | |||
369 | #[test] | ||
370 | fn goto_definition_works_for_macro_defined_fn_no_arg() { | ||
371 | check_goto( | ||
372 | " | ||
373 | //- /lib.rs | ||
374 | macro_rules! define_fn { | ||
375 | () => (fn foo() {}) | ||
376 | } | ||
377 | |||
378 | define_fn!(); | ||
379 | |||
380 | fn bar() { | ||
381 | <|>foo(); | ||
382 | } | ||
383 | ", | ||
384 | "foo FN_DEF FileId(1) [39; 42) [39; 42)", | ||
385 | ); | ||
386 | } | ||
387 | |||
388 | #[test] | ||
349 | fn goto_definition_works_for_methods() { | 389 | fn goto_definition_works_for_methods() { |
350 | covers!(goto_definition_works_for_methods); | 390 | covers!(goto_definition_works_for_methods); |
351 | check_goto( | 391 | check_goto( |