Test for the error messages from to!

This commit is contained in:
Josh Mitchell
2020-11-15 18:48:13 +11:00
parent 43cc36de99
commit be6ac4202d

View File

@@ -816,6 +816,13 @@ mod tests {
}); });
assert_eq!(expected, to!(big_number, ErrorTask::Write)); assert_eq!(expected, to!(big_number, ErrorTask::Write));
let num_atoms: usize = 304;
let res: Result<u8, _> = to!(num_atoms, ErrorTask::Write);
assert_eq!(
format!("{}", res.unwrap_err()),
"Illegal num_atoms while writing trajectory: Failed to cast 304 to u8"
);
Ok(()) Ok(())
} }
} }