mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
split: disable windows test for invalid UTF8
This commit is contained in:
parent
271a108fa9
commit
d2812cbbc3
1 changed files with 23 additions and 21 deletions
|
@ -9,7 +9,6 @@ use rand::{thread_rng, Rng, SeedableRng};
|
|||
use regex::Regex;
|
||||
#[cfg(not(windows))]
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::{
|
||||
fs::{read_dir, File},
|
||||
|
@ -1294,6 +1293,7 @@ fn test_split_invalid_input() {
|
|||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_split_non_utf8_argument_unix() {
|
||||
use std::ffi::OsStr;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
/// Test if there are invalid (non UTF-8) in the arguments - windows
|
||||
/// clap is expected to fail/panic
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn test_split_non_utf8_argument_windows() {
|
||||
use std::os::windows::prelude::*;
|
||||
// Test if there are invalid (non UTF-8) in the arguments - windows
|
||||
// clap is expected to fail/panic
|
||||
// comment it out for now
|
||||
// #[cfg(windows)]
|
||||
// #[test]
|
||||
// fn test_split_non_utf8_argument_windows() {
|
||||
// use std::ffi::OsString;
|
||||
// use std::os::windows::prelude::*;
|
||||
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let name = "test_split_non_utf8_argument";
|
||||
let opt = OsStr::from_bytes("--additional-suffix".as_bytes());
|
||||
RandomFile::new(&at, name).add_lines(2000);
|
||||
// Here the values 0x0066 and 0x006f correspond to 'f' and 'o'
|
||||
// respectively. The value 0xD800 is a lone surrogate half, invalid
|
||||
// in a UTF-16 sequence.
|
||||
let opt_value = [0x0066, 0x006f, 0xD800, 0x006f];
|
||||
let opt_value = OsString::from_wide(&opt_value[..]);
|
||||
let name = OsStr::from_bytes(name.as_bytes());
|
||||
ucmd.args(&[opt, opt_value, name])
|
||||
.fails()
|
||||
.stderr_contains("error: invalid UTF-8 was detected in one or more arguments");
|
||||
}
|
||||
// let (at, mut ucmd) = at_and_ucmd!();
|
||||
// let name = "test_split_non_utf8_argument";
|
||||
// let opt = OsStr::from_bytes("--additional-suffix".as_bytes());
|
||||
// RandomFile::new(&at, name).add_lines(2000);
|
||||
// // Here the values 0x0066 and 0x006f correspond to 'f' and 'o'
|
||||
// // respectively. The value 0xD800 is a lone surrogate half, invalid
|
||||
// // in a UTF-16 sequence.
|
||||
// let opt_value = [0x0066, 0x006f, 0xD800, 0x006f];
|
||||
// let opt_value = OsString::from_wide(&opt_value[..]);
|
||||
// let name = OsStr::from_bytes(name.as_bytes());
|
||||
// ucmd.args(&[opt, opt_value, name])
|
||||
// .fails()
|
||||
// .stderr_contains("error: invalid UTF-8 was detected in one or more arguments");
|
||||
// }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue