diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/call_info.rs | 21 |
1 files changed, 15 insertions, 6 deletions
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 { | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | fn call_info(text: &str) -> CallInfo { | 211 | fn call_info_helper(text: &str) -> Option<CallInfo> { |
212 | let (analysis, position) = single_file_with_position(text); | 212 | let (analysis, position) = single_file_with_position(text); |
213 | analysis.call_info(position).unwrap().unwrap() | 213 | analysis.call_info(position).unwrap() |
214 | } | ||
215 | |||
216 | fn call_info(text: &str) -> CallInfo { | ||
217 | let info = call_info_helper(text); | ||
218 | assert!(info.is_some()); | ||
219 | info.unwrap() | ||
220 | } | ||
221 | |||
222 | fn no_call_info(text: &str) { | ||
223 | let info = call_info_helper(text); | ||
224 | assert!(info.is_none()); | ||
214 | } | 225 | } |
215 | 226 | ||
216 | #[test] | 227 | #[test] |
@@ -558,9 +569,8 @@ fn main() { | |||
558 | } | 569 | } |
559 | 570 | ||
560 | #[test] | 571 | #[test] |
561 | #[should_panic] | ||
562 | fn cant_call_named_structs() { | 572 | fn cant_call_named_structs() { |
563 | let _ = call_info( | 573 | no_call_info( |
564 | r#" | 574 | r#" |
565 | struct TS { x: u32, y: i32 } | 575 | struct TS { x: u32, y: i32 } |
566 | fn main() { | 576 | fn main() { |
@@ -594,9 +604,8 @@ fn main() { | |||
594 | } | 604 | } |
595 | 605 | ||
596 | #[test] | 606 | #[test] |
597 | #[should_panic] | ||
598 | fn cant_call_enum_records() { | 607 | fn cant_call_enum_records() { |
599 | let _ = call_info( | 608 | no_call_info( |
600 | r#" | 609 | r#" |
601 | enum E { | 610 | enum E { |
602 | /// A Variant | 611 | /// A Variant |