mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Merge #3953
3953: Remove #[should_panic] from call_info tests r=matklad a=kjeremy Better fix than #3952 Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
This commit is contained in:
commit
f13da3f895
@ -208,9 +208,20 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_info(text: &str) -> CallInfo {
|
fn call_info_helper(text: &str) -> Option<CallInfo> {
|
||||||
let (analysis, position) = single_file_with_position(text);
|
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]
|
#[test]
|
||||||
@ -558,9 +569,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
|
||||||
fn cant_call_named_structs() {
|
fn cant_call_named_structs() {
|
||||||
let _ = call_info(
|
no_call_info(
|
||||||
r#"
|
r#"
|
||||||
struct TS { x: u32, y: i32 }
|
struct TS { x: u32, y: i32 }
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -594,9 +604,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
|
||||||
fn cant_call_enum_records() {
|
fn cant_call_enum_records() {
|
||||||
let _ = call_info(
|
no_call_info(
|
||||||
r#"
|
r#"
|
||||||
enum E {
|
enum E {
|
||||||
/// A Variant
|
/// A Variant
|
||||||
|
Loading…
Reference in New Issue
Block a user