tests: adds a check_output2 function to compare output to one of two possible solutions

This commit is contained in:
Kevin K 2018-01-09 10:16:56 -05:00
parent 6f25b2830a
commit 79c36396db

View file

@ -39,6 +39,16 @@ mod test {
assert_eq!(stderr, err.use_stderr());
compare(left, right)
}
pub fn compare_output2(l: App, args: &str, right1: &str, right2: &str, stderr: bool) -> bool {
let mut buf = Cursor::new(Vec::with_capacity(50));
let res = l.get_matches_from_safe(args.split(' ').collect::<Vec<_>>());
let err = res.unwrap_err();
err.write_to(&mut buf).unwrap();
let content = buf.into_inner();
let left = String::from_utf8(content).unwrap();
assert_eq!(stderr, err.use_stderr());
compare(&*left, right1) || compare(&*left, right2)
}
// Legacy tests from the pyhton script days