From 817a832f33c96842c81f4aa8255780e944539a14 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 8 Mar 2023 13:55:45 +0100 Subject: [PATCH 1/2] Bump clap from 4.0.26 to 4.1.8 --- Cargo.lock | 17 +++-------------- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4f489eae..69787b731 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,17 +61,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -236,13 +225,13 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.26" +version = "4.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" dependencies = [ - "atty", "bitflags", "clap_lex", + "is-terminal", "once_cell", "strsim", "termcolor", diff --git a/Cargo.toml b/Cargo.toml index d8d43b252..68542b02a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -269,7 +269,7 @@ bstr = "1.0" bytecount = "0.6.3" byteorder = "1.3.2" chrono = { version="^0.4.23", default-features=false, features=["std", "alloc", "clock"]} -clap = { version = "4.0", features = ["wrap_help", "cargo"] } +clap = { version = "4.1", features = ["wrap_help", "cargo"] } clap_complete = "4.0" clap_mangen = "0.2" compare = "0.1.0" From 3eeb5dda308f244ab6ec7cd9b9c477a0c18b39c3 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Wed, 8 Mar 2023 15:06:07 +0100 Subject: [PATCH 2/2] tests: adapt to clap's modified error messages --- tests/by-util/test_base32.rs | 2 +- tests/by-util/test_base64.rs | 2 +- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_chroot.rs | 2 +- tests/by-util/test_cp.rs | 2 +- tests/by-util/test_link.rs | 4 ++-- tests/by-util/test_mknod.rs | 6 +++--- tests/by-util/test_seq.rs | 10 ++-------- tests/by-util/test_sort.rs | 2 +- tests/by-util/test_stdbuf.rs | 2 +- tests/by-util/test_truncate.rs | 2 +- tests/by-util/test_tsort.rs | 4 +--- tests/by-util/test_who.rs | 2 +- 13 files changed, 17 insertions(+), 25 deletions(-) diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 0634d114e..19f7515d2 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -86,7 +86,7 @@ fn test_wrap() { fn test_wrap_no_arg() { for wrap_param in ["-w", "--wrap"] { let ts = TestScenario::new(util_name!()); - let expected_stderr = "The argument '--wrap ' requires a value but none was supplied"; + let expected_stderr = "a value is required for '--wrap ' but none was supplied"; ts.ucmd() .arg(wrap_param) .fails() diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 6a2563b10..9d551b321 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -79,7 +79,7 @@ fn test_wrap_no_arg() { new_ucmd!() .arg(wrap_param) .fails() - .stderr_contains("The argument '--wrap ' requires a value but none was supplied") + .stderr_contains("a value is required for '--wrap ' but none was supplied") .no_stdout(); } } diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 352ecb513..f7b298c79 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -196,7 +196,7 @@ fn test_missing_files() { .arg("groupname") .fails() .stderr_contains( - "error: The following required arguments were not provided:\n ...\n", + "error: the following required arguments were not provided:\n ...\n", ); } diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 0e3468720..b1e270577 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -15,7 +15,7 @@ fn test_missing_operand() { assert!(result .stderr_str() - .starts_with("error: The following required arguments were not provided")); + .starts_with("error: the following required arguments were not provided")); assert!(result.stderr_str().contains("")); } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index a514ce04a..188d5db63 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1495,7 +1495,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[=]'"); + .stderr_contains("error: invalid value 'bad' for '--reflink[=]'"); } #[test] diff --git a/tests/by-util/test_link.rs b/tests/by-util/test_link.rs index e52a31a33..c147fdf6c 100644 --- a/tests/by-util/test_link.rs +++ b/tests/by-util/test_link.rs @@ -52,7 +52,7 @@ fn test_link_one_argument() { let file = "test_link_argument"; ucmd.args(&[file]) .fails() - .stderr_contains("requires 2 values"); + .stderr_contains("2 values required"); } #[test] @@ -65,5 +65,5 @@ fn test_link_three_arguments() { ]; ucmd.args(&arguments[..]) .fails() - .stderr_contains("requires 2 values"); + .stderr_contains("2 values required"); } diff --git a/tests/by-util/test_mknod.rs b/tests/by-util/test_mknod.rs index c6d15e204..d2f4032c4 100644 --- a/tests/by-util/test_mknod.rs +++ b/tests/by-util/test_mknod.rs @@ -92,14 +92,14 @@ fn test_mknod_character_device_requires_major_and_minor() { .arg("1") .arg("c") .fails() - .stderr_contains("Invalid value 'c'"); + .stderr_contains("invalid value 'c'"); new_ucmd!() .arg("test_file") .arg("c") .arg("c") .arg("1") .fails() - .stderr_contains("Invalid value 'c'"); + .stderr_contains("invalid value 'c'"); } #[test] @@ -109,7 +109,7 @@ fn test_mknod_invalid_arg() { .arg("--foo") .fails() .no_stdout() - .stderr_contains("Found argument '--foo' which wasn't expected"); + .stderr_contains("unexpected argument '--foo' found"); } #[test] diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index fa73b2937..2d55ed8ce 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -36,18 +36,12 @@ fn test_hex_rejects_sign_after_identifier() { .args(&["-0x-123ABC"]) .fails() .no_stdout() - .stderr_contains( - "Found argument '-0' which wasn't expected, or isn't valid in this context", - ) - .stderr_contains("For more information try '--help'"); + .stderr_contains("unexpected argument '-0' found"); new_ucmd!() .args(&["-0x+123ABC"]) .fails() .no_stdout() - .stderr_contains( - "Found argument '-0' which wasn't expected, or isn't valid in this context", - ) - .stderr_contains("For more information try '--help'"); + .stderr_contains("unexpected argument '-0' found"); } #[test] diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 174ac255c..f2d0cd5ce 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -999,7 +999,7 @@ fn test_conflict_check_out() { .fails() .stderr_contains( // the rest of the message might be subject to change - "error: The argument", + "error: the argument", ); } } diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index b4aa64040..286cb7c24 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -30,7 +30,7 @@ fn test_stdbuf_no_buffer_option_fails() { ts.ucmd() .args(&["head"]) .fails() - .stderr_contains("The following required arguments were not provided:"); + .stderr_contains("the following required arguments were not provided:"); } #[cfg(not(target_os = "windows"))] diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index f306a32a9..e94ee13a7 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -194,7 +194,7 @@ fn test_error_filename_only() { .args(&["file"]) .fails() .code_is(1) - .stderr_contains("error: The following required arguments were not provided:"); + .stderr_contains("error: the following required arguments were not provided:"); } #[test] diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index e424fe651..16bfee461 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -50,7 +50,5 @@ fn test_multiple_arguments() { .arg("call_graph.txt") .arg("invalid_file") .fails() - .stderr_contains( - "Found argument 'invalid_file' which wasn't expected, or isn't valid in this context", - ); + .stderr_contains("unexpected argument 'invalid_file' found"); } diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 6f98c8b9d..d5ad05d97 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -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: unexpected value 'u' for '[FILE]...' found; no more were expected"; let args = ["am", "i", "u"]; new_ucmd!().args(&args).fails().stderr_contains(EXPECTED);