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

split: disable windows test for invalid UTF8

This commit is contained in:
zhitkoff 2023-08-31 16:04:44 -04:00
parent 271a108fa9
commit d2812cbbc3

View file

@ -9,7 +9,6 @@ use rand::{thread_rng, Rng, SeedableRng};
use regex::Regex; use regex::Regex;
#[cfg(not(windows))] #[cfg(not(windows))]
use std::env; use std::env;
use std::ffi::OsStr;
use std::path::Path; use std::path::Path;
use std::{ use std::{
fs::{read_dir, File}, fs::{read_dir, File},
@ -1294,6 +1293,7 @@ fn test_split_invalid_input() {
#[cfg(unix)] #[cfg(unix)]
#[test] #[test]
fn test_split_non_utf8_argument_unix() { fn test_split_non_utf8_argument_unix() {
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
@ -1311,24 +1311,26 @@ 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
#[cfg(windows)] // comment it out for now
#[test] // #[cfg(windows)]
fn test_split_non_utf8_argument_windows() { // #[test]
use std::os::windows::prelude::*; // fn test_split_non_utf8_argument_windows() {
// use std::ffi::OsString;
// 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 = OsStr::from_bytes("--additional-suffix".as_bytes());
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 = OsStr::from_bytes(name.as_bytes());
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");
} // }