From db2a989565ea2b3d3c06e34cd385cfb574a32fbb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 13 Apr 2021 12:20:54 +0300 Subject: internal: don't use `#[should_panic]` for tests --- crates/ide/src/goto_definition.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index d057d5402..a04333e63 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -110,6 +110,13 @@ mod tests { assert_eq!(expected, FileRange { file_id: nav.file_id, range: nav.focus_or_full_range() }); } + fn check_unresolved(ra_fixture: &str) { + let (analysis, position) = fixture::position(ra_fixture); + let navs = analysis.goto_definition(position).unwrap().expect("no definition found").info; + + assert!(navs.is_empty(), "didn't expect this to resolve anywhere: {:?}", navs) + } + #[test] fn goto_def_for_extern_crate() { check( @@ -927,17 +934,12 @@ fn f() -> impl Iterator {} } #[test] - #[should_panic = "unresolved reference"] fn unknown_assoc_ty() { - check( + check_unresolved( r#" -trait Iterator { - type Item; - //^^^^ -} - +trait Iterator { type Item; } fn f() -> impl Iterator {} - "#, +"#, ) } -- cgit v1.2.3