1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 19:36:16 +00:00

Merge branch 'main' into rm-correct-prompts

This commit is contained in:
Pat Laster 2022-10-15 14:58:13 -05:00 committed by GitHub
commit 7e62945fd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
249 changed files with 2734 additions and 2348 deletions

View file

@ -86,12 +86,12 @@ fn test_wrap() {
fn test_wrap_no_arg() {
for wrap_param in ["-w", "--wrap"] {
let ts = TestScenario::new(util_name!());
let expected_stderr = "error: The argument '--wrap <wrap>\' requires a value but none was \
supplied\n\nFor more information try --help";
let expected_stderr = "The argument '--wrap <COLS>' requires a value but none was supplied";
ts.ucmd()
.arg(wrap_param)
.fails()
.stderr_only(expected_stderr);
.stderr_contains(expected_stderr)
.no_stdout();
}
}

View file

@ -79,7 +79,8 @@ fn test_wrap_no_arg() {
new_ucmd!()
.arg(wrap_param)
.fails()
.stderr_contains("The argument '--wrap <wrap>' requires a value but none was supplied");
.stderr_contains("The argument '--wrap <COLS>' requires a value but none was supplied")
.no_stdout();
}
}

View file

@ -11,7 +11,7 @@ fn test_help() {
.arg(help_flg)
.succeeds()
.no_stderr()
.stdout_contains("USAGE:");
.stdout_contains("Usage:");
}
}

View file

@ -21,7 +21,7 @@ fn test_help() {
new_ucmd!()
.arg("--help")
.succeeds()
.stdout_contains("ARGS:\n <GROUP> \n <FILE>... ");
.stdout_contains("Arguments:");
}
#[test]
@ -30,7 +30,7 @@ fn test_help_ref() {
.arg("--help")
.arg("--reference=ref_file")
.succeeds()
.stdout_contains("ARGS:\n <GROUP> \n <FILE>... ");
.stdout_contains("Arguments:");
}
#[test]
@ -39,7 +39,7 @@ fn test_ref_help() {
.arg("--reference=ref_file")
.arg("--help")
.succeeds()
.stdout_contains("ARGS:\n <GROUP> \n <FILE>... ");
.stdout_contains("Arguments:");
}
#[test]
@ -196,7 +196,7 @@ fn test_missing_files() {
.arg("groupname")
.fails()
.stderr_contains(
"error: The following required arguments were not provided:\n <FILE>...\n",
"error: The following required arguments were not provided:\n <FILE>...\n",
);
}

View file

@ -1395,7 +1395,7 @@ fn test_cp_reflink_bad() {
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_EXISTING_FILE)
.fails()
.stderr_contains("error: \"bad\" isn't a valid value for '--reflink[=<WHEN>...]'");
.stderr_contains("error: \"bad\" isn't a valid value for '--reflink[=<WHEN>]'");
}
#[test]
@ -1551,6 +1551,7 @@ fn test_cp_sparse_never_reflink_always() {
}
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(feature = "truncate")]
#[test]
fn test_cp_reflink_always_override() {
let scene = TestScenario::new(util_name!());
@ -1639,6 +1640,7 @@ fn test_copy_dir_symlink() {
#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
#[cfg(feature = "ln")]
fn test_copy_dir_with_symlinks() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("dir");

View file

@ -16,7 +16,7 @@ fn test_env_help() {
.arg("--help")
.succeeds()
.no_stderr()
.stdout_contains("OPTIONS:");
.stdout_contains("Options:");
}
#[test]
@ -120,8 +120,8 @@ fn test_multiple_name_value_pairs() {
fn test_ignore_environment() {
let scene = TestScenario::new(util_name!());
scene.ucmd().arg("-i").run().no_stdout();
scene.ucmd().arg("-").run().no_stdout();
scene.ucmd().arg("-i").succeeds().no_stdout();
scene.ucmd().arg("-").succeeds().no_stdout();
}
#[test]

View file

@ -8,10 +8,8 @@
// spell-checker:ignore (methods) hexdigest
use tempfile::TempDir;
use crate::common::util::*;
use std::fs::OpenOptions;
use std::time::SystemTime;
#[path = "../../src/uu/factor/sieve.rs"]
@ -33,9 +31,12 @@ fn test_invalid_arg() {
}
#[test]
#[cfg(feature = "sort")]
fn test_parallel() {
use hex_literal::hex;
use sha1::{Digest, Sha1};
use std::fs::OpenOptions;
use tempfile::TempDir;
// factor should only flush the buffer at line breaks
let n_integers = 100_000;
let mut input_string = String::new();

View file

@ -50,9 +50,9 @@ fn test_link_nonexistent_file() {
fn test_link_one_argument() {
let (_, mut ucmd) = at_and_ucmd!();
let file = "test_link_argument";
ucmd.args(&[file]).fails().stderr_contains(
"error: The argument '<FILES>...' requires at least 2 values but only 1 was provided",
);
ucmd.args(&[file])
.fails()
.stderr_contains("requires 2 values");
}
#[test]
@ -63,7 +63,7 @@ fn test_link_three_arguments() {
"test_link_argument2",
"test_link_argument3",
];
ucmd.args(&arguments[..]).fails().stderr_contains(
format!("error: The value '{}' was provided to '<FILES>...' but it wasn't expecting any more values", arguments[2]),
);
ucmd.args(&arguments[..])
.fails()
.stderr_contains("requires 2 values");
}

View file

@ -3248,6 +3248,7 @@ fn test_ls_multiple_a_A() {
}
#[test]
#[cfg(feature = "ln")]
fn test_ls_quoting() {
let scene = TestScenario::new(util_name!());
@ -3267,6 +3268,7 @@ fn test_ls_quoting() {
}
#[test]
#[cfg(feature = "ln")]
fn test_ls_quoting_color() {
let scene = TestScenario::new(util_name!());

View file

@ -13,7 +13,7 @@ fn test_mknod_help() {
.arg("--help")
.succeeds()
.no_stderr()
.stdout_contains("USAGE:");
.stdout_contains("Usage:");
}
#[test]
@ -92,14 +92,14 @@ fn test_mknod_character_device_requires_major_and_minor() {
.arg("1")
.arg("c")
.fails()
.stderr_contains("Invalid value \"c\" for '<MINOR>'");
.stderr_contains("Invalid value \"c\"");
new_ucmd!()
.arg("test_file")
.arg("c")
.arg("c")
.arg("1")
.fails()
.stderr_contains("Invalid value \"c\" for '<MAJOR>'");
.stderr_contains("Invalid value \"c\"");
}
#[test]

View file

@ -803,6 +803,7 @@ fn test_mv_verbose() {
#[test]
#[cfg(any(target_os = "linux", target_os = "android"))] // mkdir does not support -m on windows. Freebsd doesn't return a permission error either.
#[cfg(features = "mkdir")]
fn test_mv_permission_error() {
let scene = TestScenario::new("mkdir");
let folder1 = "bar";

View file

@ -453,3 +453,8 @@ fn test_realpath_trailing_slash() {
.succeeds()
.stdout_contains(format!("{}no_dir\n", std::path::MAIN_SEPARATOR));
}
#[test]
fn test_realpath_empty() {
new_ucmd!().fails().code_is(1);
}

View file

@ -26,13 +26,13 @@ fn test_hex_rejects_sign_after_identifier() {
.fails()
.no_stdout()
.stderr_contains("which wasn't expected, or isn't valid in this context")
.stderr_contains("For more information try --help");
.stderr_contains("For more information try '--help'");
new_ucmd!()
.args(&["-0x+123ABC"])
.fails()
.no_stdout()
.stderr_contains("which wasn't expected, or isn't valid in this context")
.stderr_contains("For more information try --help");
.stderr_contains("For more information try '--help'");
}
#[test]

View file

@ -27,17 +27,10 @@ fn test_stdbuf_line_buffered_stdout() {
fn test_stdbuf_no_buffer_option_fails() {
let ts = TestScenario::new(util_name!());
ts.ucmd().args(&["head"]).fails().stderr_is(&format!(
"error: The following required arguments were not provided:\n \
--input <MODE>\n \
--output <MODE>\n \
--error <MODE>\n\n\
USAGE:\n \
{1} {0} OPTION... COMMAND\n\n\
For more information try --help",
ts.util_name,
ts.bin_path.to_string_lossy()
));
ts.ucmd()
.args(&["head"])
.fails()
.stderr_contains("The following required arguments were not provided:");
}
#[cfg(not(target_os = "windows"))]

View file

@ -903,7 +903,7 @@ fn test_bracket_syntax_help() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.arg("--help").succeeds().stdout_contains("USAGE:");
ucmd.arg("--help").succeeds().stdout_contains("Usage:");
}
#[test]

View file

@ -254,11 +254,7 @@ fn test_error_filename_only() {
.args(&["file"])
.fails()
.code_is(1)
.stderr_contains(
"error: The following required arguments were not provided:
--reference <RFILE>
--size <SIZE>",
);
.stderr_contains("error: The following required arguments were not provided:");
}
#[test]

View file

@ -31,7 +31,7 @@ fn test_unlink_multiple_files() {
ucmd.arg(file_a)
.arg(file_b)
.fails()
.stderr_contains("USAGE");
.stderr_contains("Usage");
}
#[test]

View file

@ -151,7 +151,7 @@ fn test_arg1_arg2() {
#[test]
fn test_too_many_args() {
const EXPECTED: &str =
"error: The value 'u' was provided to '<FILE>...' but it wasn't expecting any more values";
"error: The value 'u' was provided to '[FILE]...' but it wasn't expecting any more values";
let args = ["am", "i", "u"];
new_ucmd!().args(&args).fails().stderr_contains(EXPECTED);

View file

@ -1856,6 +1856,7 @@ mod tests {
// This error was first detected when running tail so tail is used here but
// should fail with any command that takes piped input.
// See also https://github.com/uutils/coreutils/issues/3895
#[cfg(feature = "tail")]
#[test]
#[cfg_attr(not(feature = "expensive_tests"), ignore)]
fn test_when_piped_input_then_no_broken_pipe() {

View file

@ -21,7 +21,7 @@ fn execution_phrase_double() {
.unwrap();
assert!(String::from_utf8(output.stderr)
.unwrap()
.contains(&format!("USAGE:\n {} ls", scenario.bin_path.display(),)));
.contains(&format!("Usage: {} ls", scenario.bin_path.display(),)));
}
#[test]
@ -36,8 +36,9 @@ fn execution_phrase_single() {
.arg("--some-invalid-arg")
.output()
.unwrap();
dbg!(String::from_utf8(output.stderr.clone()).unwrap());
assert!(String::from_utf8(output.stderr).unwrap().contains(&format!(
"USAGE:\n {}",
"Usage: {}",
scenario.fixtures.plus("uu-ls").display()
)));
}