Skip to content

Commit 6926c84

Browse files
committed
tests: output the error when one occurs when parsing
1 parent 084cbd7 commit 6926c84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tests/utils/kernel.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,18 @@ lazy_static! {
109109
.unwrap();
110110
}
111111

112-
fn by_name<T: FromStr>(capture: &Captures, name: &str) -> T {
112+
fn by_name<T>(capture: &Captures, name: &str) -> T
113+
where
114+
T: FromStr,
115+
T::Err: std::fmt::Display,
116+
{
113117
let cap = capture
114118
.name(name)
115119
.expect("name should be captured")
116120
.as_str();
117121
match cap.parse() {
118122
Ok(v) => v,
119-
Err(_) => panic!("failed to parse {} as an integer", name),
123+
Err(err) => panic!("failed to parse {} as an integer: {}", name, err),
120124
}
121125
}
122126

0 commit comments

Comments
 (0)