Log more diagnostic info in 'assert_form_parses'.

This commit is contained in:
Sergio Benitez 2021-04-23 21:00:38 -07:00
parent 801e04bd53
commit 9be9fc917b
1 changed files with 7 additions and 2 deletions

View File

@ -22,8 +22,13 @@ macro_rules! bmap {
#[macro_export]
macro_rules! assert_form_parses {
($T:ty, $form:expr => $value:expr) => (
let v = rocket::form::Form::<$T>::parse($form).unwrap();
assert_eq!(v, $value, "{}", $form);
match rocket::form::Form::<$T>::parse($form) {
Ok(v) => assert_eq!(v, $value, "{}", $form),
Err(e) => {
eprintln!("form failed to parse\n> form: {:?}\n> error: {:?}", $form, e);
panic!("form parse failure");
}
}
);
($T:ty, $($form:expr => $value:expr),+ $(,)?) => (