Skip to content

Commit

Permalink
test: OsArgsContainsInvalidUnicode error does not occur on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed May 27, 2024
1 parent 2c71b2c commit 0123b70
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ impl cmp::PartialEq for ParseError<'_> {
#[cfg(test)]
mod tests_of_cliargs_error {

#[cfg(not(windows))] // Because basically OsStr is valid WTF8 and OsString is valid WTF16 on windows
mod tests_of_os_args_contain_invalid_unicode {
use crate::Error;
use std::error;
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ mod tests_of_cmd {
assert_eq!(cmd.name(), "app");
}

#[cfg(not(windows))] // Because basically OsStr is valid WTF8 and OsString is valid WTF16 on windows
#[test]
fn should_fail_because_os_args_contain_invalid_unicode() {
let bad_arg = b"bar\xFFbaz";
Expand All @@ -337,6 +338,7 @@ mod tests_of_cmd {
}
}

#[cfg(not(windows))] // Because basically OsStr is valid WTF8 and OsString is valid WTF16 on windows
#[test]
fn should_fail_because_command_name_contains_invalid_unicode() {
let bad_arg = b"bar\xFFbaz";
Expand Down
1 change: 1 addition & 0 deletions tests/parse_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ mod tests_of_errors {
use cliargs;
use std::ffi;

#[cfg(not(windows))] // Because basically OsStr is valid WTF8 and OsString is valid WTF16 on windows
#[test]
fn it_should_parse_but_fail_because_command_line_arguments_contain_invalid_unicode() {
let bad_arg = b"bar\xFF";
Expand Down

0 comments on commit 0123b70

Please sign in to comment.