Skip to content

Commit

Permalink
test(parser): Show UTF8 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 11, 2022
1 parent 4d69e56 commit 45d26e0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/builder/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 45d26e0

Please sign in to comment.