aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-11 21:58:59 +0100
committerGitHub <[email protected]>2020-04-11 21:58:59 +0100
commitf13da3f895d9d401ff467a6c1fa33a4adf09fe2c (patch)
treee025afecb8ea88319b9a04d227aa59dbb2b60d1d
parentfd06fe7b13045185ab4e630b0044aa9d8bbcdf8a (diff)
parent0f5d6766fd5b18716ede611060a69cbff9c2a35c (diff)
Merge #3953
3953: Remove #[should_panic] from call_info tests r=matklad a=kjeremy Better fix than #3952 Co-authored-by: Jeremy Kolb <[email protected]>
-rw-r--r--crates/ra_ide/src/call_info.rs21
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#"
565struct TS { x: u32, y: i32 } 575struct TS { x: u32, y: i32 }
566fn main() { 576fn 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#"
601enum E { 610enum E {
602 /// A Variant 611 /// A Variant