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

Merge branch 'main' into hbina-tr-reimplement-expansion

This commit is contained in:
Terts Diepraam 2022-01-21 14:42:30 +01:00
commit 9ddd61ab6b
226 changed files with 2603 additions and 2408 deletions

View file

@ -9,16 +9,6 @@ use std::process::Command;
#[cfg(target_os = "linux")]
use std::thread::sleep;
#[test]
fn test_install_help() {
let (_, mut ucmd) = at_and_ucmd!();
ucmd.arg("--help")
.succeeds()
.no_stderr()
.stdout_contains("FLAGS:");
}
#[test]
fn test_install_basic() {
let (at, mut ucmd) = at_and_ucmd!();

View file

@ -58,6 +58,6 @@ fn test_link_three_arguments() {
"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]),
format!("error: The value '{}' was provided to '<FILES>...' but it wasn't expecting any more values", arguments[2]),
);
}

View file

@ -1995,48 +1995,42 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("--hide")
.arg("*")
.arg("--hide=*")
.arg("-1")
.succeeds()
.stdout_only("");
scene
.ucmd()
.arg("--ignore")
.arg("*")
.arg("--ignore=*")
.arg("-1")
.succeeds()
.stdout_only("");
scene
.ucmd()
.arg("--ignore")
.arg("irrelevant pattern")
.arg("--ignore=irrelevant pattern")
.arg("-1")
.succeeds()
.stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n");
scene
.ucmd()
.arg("--ignore")
.arg("README*.md")
.arg("--ignore=README*.md")
.arg("-1")
.succeeds()
.stdout_only("CONTRIBUTING.md\nsome_other_file\n");
scene
.ucmd()
.arg("--hide")
.arg("README*.md")
.arg("--hide=README*.md")
.arg("-1")
.succeeds()
.stdout_only("CONTRIBUTING.md\nsome_other_file\n");
scene
.ucmd()
.arg("--ignore")
.arg("*.md")
.arg("--ignore=*.md")
.arg("-1")
.succeeds()
.stdout_only("some_other_file\n");
@ -2044,8 +2038,7 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("-a")
.arg("--ignore")
.arg("*.md")
.arg("--ignore=*.md")
.arg("-1")
.succeeds()
.stdout_only(".\n..\nsome_other_file\n");
@ -2053,8 +2046,7 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("-a")
.arg("--hide")
.arg("*.md")
.arg("--hide=*.md")
.arg("-1")
.succeeds()
.stdout_only(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n");
@ -2062,8 +2054,7 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("-A")
.arg("--ignore")
.arg("*.md")
.arg("--ignore=*.md")
.arg("-1")
.succeeds()
.stdout_only("some_other_file\n");
@ -2071,8 +2062,7 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("-A")
.arg("--hide")
.arg("*.md")
.arg("--hide=*.md")
.arg("-1")
.succeeds()
.stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n");
@ -2080,30 +2070,24 @@ fn test_ls_ignore_hide() {
// Stacking multiple patterns
scene
.ucmd()
.arg("--ignore")
.arg("README*")
.arg("--ignore")
.arg("CONTRIBUTING*")
.arg("--ignore=README*")
.arg("--ignore=CONTRIBUTING*")
.arg("-1")
.succeeds()
.stdout_only("some_other_file\n");
scene
.ucmd()
.arg("--hide")
.arg("README*")
.arg("--ignore")
.arg("CONTRIBUTING*")
.arg("--hide=README*")
.arg("--ignore=CONTRIBUTING*")
.arg("-1")
.succeeds()
.stdout_only("some_other_file\n");
scene
.ucmd()
.arg("--hide")
.arg("README*")
.arg("--hide")
.arg("CONTRIBUTING*")
.arg("--hide=README*")
.arg("--hide=CONTRIBUTING*")
.arg("-1")
.succeeds()
.stdout_only("some_other_file\n");
@ -2111,8 +2095,7 @@ fn test_ls_ignore_hide() {
// Invalid patterns
scene
.ucmd()
.arg("--ignore")
.arg("READ[ME")
.arg("--ignore=READ[ME")
.arg("-1")
.succeeds()
.stderr_contains(&"Invalid pattern")
@ -2120,8 +2103,7 @@ fn test_ls_ignore_hide() {
scene
.ucmd()
.arg("--hide")
.arg("READ[ME")
.arg("--hide=READ[ME")
.arg("-1")
.succeeds()
.stderr_contains(&"Invalid pattern")

View file

@ -86,7 +86,6 @@ fn test_mknod_character_device_requires_major_and_minor() {
.arg("1")
.arg("c")
.fails()
.status_code(1)
.stderr_contains(&"Invalid value for '<MINOR>'");
new_ucmd!()
.arg("test_file")
@ -94,7 +93,6 @@ fn test_mknod_character_device_requires_major_and_minor() {
.arg("c")
.arg("1")
.fails()
.status_code(1)
.stderr_contains(&"Invalid value for '<MAJOR>'");
}
@ -104,7 +102,6 @@ fn test_mknod_invalid_arg() {
new_ucmd!()
.arg("--foo")
.fails()
.status_code(1)
.no_stdout()
.stderr_contains(&"Found argument '--foo' which wasn't expected");
}

View file

@ -58,7 +58,7 @@ fn test_long_format_multiple_users() {
#[test]
fn test_long_format_wo_user() {
// "no username specified; at least one must be specified when using -l"
new_ucmd!().arg("-l").fails().code_is(1);
new_ucmd!().arg("-l").fails();
}
#[cfg(unix)]

View file

@ -315,18 +315,6 @@ fn test_rm_verbose_slash() {
assert!(!at.file_exists(file_a));
}
#[test]
fn test_rm_silently_accepts_presume_input_tty1() {
let (at, mut ucmd) = at_and_ucmd!();
let file_1 = "test_rm_silently_accepts_presume_input_tty1";
at.touch(file_1);
ucmd.arg("--presume-input-tty").arg(file_1).succeeds();
assert!(!at.file_exists(file_1));
}
#[test]
fn test_rm_silently_accepts_presume_input_tty2() {
let (at, mut ucmd) = at_and_ucmd!();
@ -338,15 +326,3 @@ fn test_rm_silently_accepts_presume_input_tty2() {
assert!(!at.file_exists(file_2));
}
#[test]
fn test_rm_silently_accepts_presume_input_tty3() {
let (at, mut ucmd) = at_and_ucmd!();
let file_3 = "test_rm_silently_accepts_presume_input_tty3";
at.touch(file_3);
ucmd.arg("----presume-input-tty").arg(file_3).succeeds();
assert!(!at.file_exists(file_3));
}

View file

@ -154,9 +154,7 @@ fn test_shuf_echo_and_input_range_not_allowed() {
new_ucmd!()
.args(&["-e", "0", "-i", "0-2"])
.fails()
.stderr_contains(
"The argument '--input-range <LO-HI>' cannot be used with '--echo <ARG>...'",
);
.stderr_contains("cannot be used with");
}
#[test]
@ -164,7 +162,7 @@ fn test_shuf_input_range_and_file_not_allowed() {
new_ucmd!()
.args(&["-i", "0-9", "file"])
.fails()
.stderr_contains("The argument '<file>' cannot be used with '--input-range <LO-HI>'");
.stderr_contains("cannot be used with");
}
#[test]

View file

@ -996,7 +996,8 @@ fn test_conflict_check_out() {
.arg("-o=/dev/null")
.fails()
.stderr_contains(
"error: The argument '--output <FILENAME>' cannot be used with '--check",
// the rest of the message might be subject to change
"error: The argument",
);
}
}

View file

@ -29,9 +29,9 @@ fn test_stdbuf_no_buffer_option_fails() {
ts.ucmd().args(&["head"]).fails().stderr_is(&format!(
"error: The following required arguments were not provided:\n \
--error <MODE>\n \
--input <MODE>\n \
--output <MODE>\n\n\
--output <MODE>\n \
--error <MODE>\n\n\
USAGE:\n \
{1} {0} OPTION... COMMAND\n\n\
For more information try --help",

View file

@ -3,7 +3,7 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
// spell-checker:ignore (ToDO) abcdefghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz vwxyz emptyfile
// spell-checker:ignore (ToDO) abcdefghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz vwxyz emptyfile bogusfile
extern crate tail;
@ -475,3 +475,17 @@ fn test_tail_bytes_for_funny_files() {
.code_is(exp_result.code());
}
}
#[test]
fn test_no_such_file() {
new_ucmd!()
.arg("bogusfile")
.fails()
.no_stdout()
.stderr_contains("cannot open 'bogusfile' for reading: No such file or directory");
}
#[test]
fn test_no_trailing_newline() {
new_ucmd!().pipe_in("x").succeeds().stdout_only("x");
}

View file

@ -287,13 +287,8 @@ fn test_interpret_backslash_at_eol_literally() {
}
#[test]
// FixME: panicked at 'failed to write to stdin of child: Broken pipe (os error 32)
#[cfg(not(target_os = "freebsd"))]
fn test_more_than_2_sets() {
new_ucmd!()
.args(&["'abcdef'", "'a'", "'b'"])
.pipe_in("hello world")
.fails();
new_ucmd!().args(&["'abcdef'", "'a'", "'b'"]).fails();
}
#[test]

View file

@ -136,7 +136,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);