From 0f5d6766fd5b18716ede611060a69cbff9c2a35c Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sat, 11 Apr 2020 15:47:09 -0400 Subject: Remove #[should_panic] from call_info tests --- crates/ra_ide/src/call_info.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'crates') diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index ca57eceff..f95b6baf3 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs @@ -208,9 +208,20 @@ mod tests { } } - fn call_info(text: &str) -> CallInfo { + fn call_info_helper(text: &str) -> Option { let (analysis, position) = single_file_with_position(text); - analysis.call_info(position).unwrap().unwrap() + analysis.call_info(position).unwrap() + } + + fn call_info(text: &str) -> CallInfo { + let info = call_info_helper(text); + assert!(info.is_some()); + info.unwrap() + } + + fn no_call_info(text: &str) { + let info = call_info_helper(text); + assert!(info.is_none()); } #[test] @@ -558,9 +569,8 @@ fn main() { } #[test] - #[should_panic] fn cant_call_named_structs() { - let _ = call_info( + no_call_info( r#" struct TS { x: u32, y: i32 } fn main() { @@ -594,9 +604,8 @@ fn main() { } #[test] - #[should_panic] fn cant_call_enum_records() { - let _ = call_info( + no_call_info( r#" enum E { /// A Variant -- cgit v1.2.3