mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
test(parser): Show UTF8 bug
This commit is contained in:
parent
4d69e56f06
commit
45d26e0013
1 changed files with 23 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue