diff --git a/tests/builder/utf8.rs b/tests/builder/utf8.rs index 03f8e9f2..08e6cf50 100644 --- a/tests/builder/utf8.rs +++ b/tests/builder/utf8.rs @@ -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")