test(parser): Show UTF8 bug

This commit is contained in:
Ed Page 2022-11-11 12:22:30 -06:00
parent 4d69e56f06
commit 45d26e0013

View file

@ -100,6 +100,29 @@ fn invalid_utf8_strict_option_long_equals() {
assert_eq!(m.unwrap_err().kind(), ErrorKind::InvalidUtf8);
}
#[test]
fn invalid_utf8_strict_invalid_short() {
let m = Command::new("bad_utf8").try_get_matches_from(vec![
OsString::from(""),
OsString::from("-a"),
OsString::from_vec(vec![0xe9]),
]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::UnknownArgument);
}
#[test]
#[should_panic]
fn invalid_utf8_strict_invalid_long() {
let m = Command::new("bad_utf8").try_get_matches_from(vec![
OsString::from(""),
OsString::from("--arg"),
OsString::from_vec(vec![0xe9]),
]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::UnknownArgument);
}
#[test]
fn invalid_utf8_positional() {
let r = Command::new("bad_utf8")