mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-16 16:20:49 +00:00
Prettier format panic message in spectest.
This commit is contained in:
parent
3ff3554345
commit
79613e42d7
@ -256,6 +256,16 @@ mod tests {
|
||||
Memory, Table,
|
||||
};
|
||||
|
||||
fn format_panic(e: &dyn std::any::Any) -> String {
|
||||
if let Some(s) = e.downcast_ref::<&str>() {
|
||||
format!("{}", s)
|
||||
} else if let Some(s) = e.downcast_ref::<String>() {
|
||||
format!("{}", s)
|
||||
} else {
|
||||
"(unknown)".into()
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_and_run(
|
||||
path: &PathBuf,
|
||||
file_excludes: &HashSet<String>,
|
||||
@ -342,7 +352,7 @@ mod tests {
|
||||
file: filename.to_string(),
|
||||
line: line,
|
||||
kind: format!("{}", "Module"),
|
||||
message: format!("caught panic {:?}", e),
|
||||
message: format!("caught panic {:?}", format_panic(&e)),
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
@ -798,7 +808,7 @@ mod tests {
|
||||
file: filename.to_string(),
|
||||
line: line,
|
||||
kind: format!("{}", "AssertInvalid"),
|
||||
message: format!("caught panic {:?}", p),
|
||||
message: format!("caught panic {:?}", format_panic(&p)),
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
@ -851,7 +861,7 @@ mod tests {
|
||||
file: filename.to_string(),
|
||||
line: line,
|
||||
kind: format!("{}", "AssertMalformed"),
|
||||
message: format!("caught panic {:?}", p),
|
||||
message: format!("caught panic {:?}", format_panic(&p)),
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
@ -975,7 +985,7 @@ mod tests {
|
||||
file: filename.to_string(),
|
||||
line: line,
|
||||
kind: format!("{}", "AssertUnlinkable"),
|
||||
message: format!("caught panic {:?}", e),
|
||||
message: format!("caught panic {:?}", format_panic(&e)),
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
|
Loading…
x
Reference in New Issue
Block a user