1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

split: fixed windows test for invalid unicode args

This commit is contained in:
zhitkoff 2023-08-31 20:48:44 -04:00
parent d2812cbbc3
commit e597189be7

View file

@ -1290,8 +1290,8 @@ fn test_split_invalid_input() {
/// Test if there are invalid (non UTF-8) in the arguments - unix /// Test if there are invalid (non UTF-8) in the arguments - unix
/// clap is expected to fail/panic /// clap is expected to fail/panic
#[cfg(unix)]
#[test] #[test]
#[cfg(unix)]
fn test_split_non_utf8_argument_unix() { fn test_split_non_utf8_argument_unix() {
use std::ffi::OsStr; use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
@ -1311,26 +1311,25 @@ fn test_split_non_utf8_argument_unix() {
.stderr_contains("error: invalid UTF-8 was detected in one or more arguments"); .stderr_contains("error: invalid UTF-8 was detected in one or more arguments");
} }
// Test if there are invalid (non UTF-8) in the arguments - windows /// Test if there are invalid (non UTF-8) in the arguments - windows
// clap is expected to fail/panic /// clap is expected to fail/panic
// comment it out for now #[test]
// #[cfg(windows)] #[cfg(windows)]
// #[test] fn test_split_non_utf8_argument_windows() {
// fn test_split_non_utf8_argument_windows() { use std::ffi::OsString;
// use std::ffi::OsString; use std::os::windows::ffi::OsStringExt;
// use std::os::windows::prelude::*;
// let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
// let name = "test_split_non_utf8_argument"; let name = "test_split_non_utf8_argument";
// let opt = OsStr::from_bytes("--additional-suffix".as_bytes()); let opt = OsString::from("--additional-suffix");
// RandomFile::new(&at, name).add_lines(2000); RandomFile::new(&at, name).add_lines(2000);
// // Here the values 0x0066 and 0x006f correspond to 'f' and 'o' // Here the values 0x0066 and 0x006f correspond to 'f' and 'o'
// // respectively. The value 0xD800 is a lone surrogate half, invalid // respectively. The value 0xD800 is a lone surrogate half, invalid
// // in a UTF-16 sequence. // in a UTF-16 sequence.
// let opt_value = [0x0066, 0x006f, 0xD800, 0x006f]; let opt_value = [0x0066, 0x006f, 0xD800, 0x006f];
// let opt_value = OsString::from_wide(&opt_value[..]); let opt_value = OsString::from_wide(&opt_value[..]);
// let name = OsStr::from_bytes(name.as_bytes()); let name = OsString::from(name);
// ucmd.args(&[opt, opt_value, name]) ucmd.args(&[opt, opt_value, name])
// .fails() .fails()
// .stderr_contains("error: invalid UTF-8 was detected in one or more arguments"); .stderr_contains("error: invalid UTF-8 was detected in one or more arguments");
// } }