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

refactor ~ revert to single quotes for "Try '{0 --help'"

This is a test expectation for gnu.
This commit is contained in:
Michael Debertol 2021-08-14 17:21:18 +02:00
parent 6ab3d27c4e
commit 5f2335829a
25 changed files with 33 additions and 33 deletions

View file

@ -46,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if !matches.is_present(options::NAME) { if !matches.is_present(options::NAME) {
crash!( crash!(
1, 1,
"{1}\nTry `{0} --help` for more information.", "{1}\nTry '{0} --help' for more information.",
execution_phrase!(), execution_phrase!(),
"missing operand" "missing operand"
); );
@ -60,7 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if !multiple_paths && matches.occurrences_of(options::NAME) > 2 { if !multiple_paths && matches.occurrences_of(options::NAME) > 2 {
crash!( crash!(
1, 1,
"extra operand '{1}'\nTry `{0} --help` for more information.", "extra operand '{1}'\nTry '{0} --help' for more information.",
execution_phrase!(), execution_phrase!(),
matches.values_of(options::NAME).unwrap().nth(2).unwrap() matches.values_of(options::NAME).unwrap().nth(2).unwrap()
); );

View file

@ -45,7 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
Some(v) => Path::new(v), Some(v) => Path::new(v),
None => crash!( None => crash!(
1, 1,
"Missing operand: NEWROOT\nTry `{} --help` for more information.", "Missing operand: NEWROOT\nTry '{} --help' for more information.",
execution_phrase!() execution_phrase!()
), ),
}; };

View file

@ -99,7 +99,7 @@ quick_error! {
NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) } NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) }
/// Invalid arguments to backup /// Invalid arguments to backup
Backup(description: String) { display("{}\nTry `{} --help` for more information.", description, execution_phrase!()) } Backup(description: String) { display("{}\nTry '{} --help' for more information.", description, execution_phrase!()) }
} }
} }

View file

@ -422,7 +422,7 @@ Valid arguments are:
- 'full-iso' - 'full-iso'
- 'long-iso' - 'long-iso'
- 'iso' - 'iso'
Try `{} --help` for more information.", Try '{} --help' for more information.",
s, s,
execution_phrase!() execution_phrase!()
), ),

View file

@ -68,7 +68,7 @@ impl Display for LnError {
} }
Self::ExtraOperand(s) => write!( Self::ExtraOperand(s) => write!(
f, f,
"extra operand '{}'\nTry `{} --help` for more information.", "extra operand '{}'\nTry '{} --help' for more information.",
s, s,
execution_phrase!() execution_phrase!()
), ),

View file

@ -113,7 +113,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if ch == 'p' { if ch == 'p' {
if matches.is_present("major") || matches.is_present("minor") { if matches.is_present("major") || matches.is_present("minor") {
eprintln!("Fifos do not have major and minor device numbers."); eprintln!("Fifos do not have major and minor device numbers.");
eprintln!("Try `{} --help` for more information.", execution_phrase!()); eprintln!("Try '{} --help' for more information.", execution_phrase!());
1 1
} else { } else {
_mknod(file_name, S_IFIFO | mode, 0) _mknod(file_name, S_IFIFO | mode, 0)
@ -122,7 +122,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
match (matches.value_of("major"), matches.value_of("minor")) { match (matches.value_of("major"), matches.value_of("minor")) {
(None, None) | (_, None) | (None, _) => { (None, None) | (_, None) | (None, _) => {
eprintln!("Special files require major and minor device numbers."); eprintln!("Special files require major and minor device numbers.");
eprintln!("Try `{} --help` for more information.", execution_phrase!()); eprintln!("Try '{} --help' for more information.", execution_phrase!());
1 1
} }
(Some(major), Some(minor)) => { (Some(major), Some(minor)) => {

View file

@ -294,7 +294,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 {
if b.no_target_dir { if b.no_target_dir {
show_error!( show_error!(
"mv: extra operand '{}'\n\ "mv: extra operand '{}'\n\
Try `{} --help` for more information.", Try '{} --help' for more information.",
files[2].display(), files[2].display(),
execution_phrase!() execution_phrase!()
); );

View file

@ -53,7 +53,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
Some(nstr) => { Some(nstr) => {
if !matches.is_present(options::COMMAND) { if !matches.is_present(options::COMMAND) {
show_error!( show_error!(
"A command must be given with an adjustment.\nTry `{} --help` for more information.", "A command must be given with an adjustment.\nTry '{} --help' for more information.",
execution_phrase!() execution_phrase!()
); );
return 125; return 125;

View file

@ -69,7 +69,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let paths = matches.values_of(options::PATH); let paths = matches.values_of(options::PATH);
let mut res = if paths.is_none() { let mut res = if paths.is_none() {
show_error!( show_error!(
"missing operand\nTry `{} --help` for more information", "missing operand\nTry '{} --help' for more information",
execution_phrase!() execution_phrase!()
); );
false false

View file

@ -283,7 +283,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if args.len() <= 1 { if args.len() <= 1 {
println!( println!(
"{0}: missing operand\nTry `{1} --help` for more information.", "{0}: missing operand\nTry '{1} --help' for more information.",
util_name!(), util_name!(),
execution_phrase!() execution_phrase!()
); );

View file

@ -58,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if files.is_empty() { if files.is_empty() {
crash!( crash!(
1, 1,
"missing operand\nTry `{} --help` for more information", "missing operand\nTry '{} --help' for more information",
execution_phrase!() execution_phrase!()
); );
} }

View file

@ -70,13 +70,13 @@ impl FromStr for Number {
Ok(n) => Ok(Number::BigInt(n)), Ok(n) => Ok(Number::BigInt(n)),
Err(_) => match s.parse::<f64>() { Err(_) => match s.parse::<f64>() {
Ok(value) if value.is_nan() => Err(format!( Ok(value) if value.is_nan() => Err(format!(
"invalid 'not-a-number' argument: '{}'\nTry `{} --help` for more information.", "invalid 'not-a-number' argument: '{}'\nTry '{} --help' for more information.",
s, s,
execution_phrase!(), execution_phrase!(),
)), )),
Ok(value) => Ok(Number::F64(value)), Ok(value) => Ok(Number::F64(value)),
Err(_) => Err(format!( Err(_) => Err(format!(
"invalid floating point argument: '{}'\nTry `{} --help` for more information.", "invalid floating point argument: '{}'\nTry '{} --help' for more information.",
s, s,
execution_phrase!(), execution_phrase!(),
)), )),
@ -121,7 +121,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
}; };
if increment.is_zero() { if increment.is_zero() {
show_error!( show_error!(
"invalid Zero increment value: '{}'\nTry `{} --help` for more information.", "invalid Zero increment value: '{}'\nTry '{} --help' for more information.",
numbers[1], numbers[1],
execution_phrase!() execution_phrase!()
); );

View file

@ -159,7 +159,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let options = ProgramOptions::try_from(&matches).unwrap_or_else(|e| { let options = ProgramOptions::try_from(&matches).unwrap_or_else(|e| {
crash!( crash!(
125, 125,
"{}\nTry `{} --help` for more information.", "{}\nTry '{} --help' for more information.",
e.0, e.0,
execution_phrase!() execution_phrase!()
) )

View file

@ -263,7 +263,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if sets.is_empty() { if sets.is_empty() {
show_error!( show_error!(
"missing operand\nTry `{} --help` for more information.", "missing operand\nTry '{} --help' for more information.",
execution_phrase!() execution_phrase!()
); );
return 1; return 1;
@ -271,7 +271,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if !(delete_flag || squeeze_flag) && sets.len() < 2 { if !(delete_flag || squeeze_flag) && sets.len() < 2 {
show_error!( show_error!(
"missing operand after '{}'\nTry `{} --help` for more information.", "missing operand after '{}'\nTry '{} --help' for more information.",
sets[0], sets[0],
execution_phrase!() execution_phrase!()
); );

View file

@ -43,13 +43,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
if paths.is_empty() { if paths.is_empty() {
crash!( crash!(
1, 1,
"missing operand\nTry `{0} --help` for more information.", "missing operand\nTry '{0} --help' for more information.",
execution_phrase!() execution_phrase!()
); );
} else if paths.len() > 1 { } else if paths.len() > 1 {
crash!( crash!(
1, 1,
"extra operand: '{1}'\nTry `{0} --help` for more information.", "extra operand: '{1}'\nTry '{0} --help' for more information.",
execution_phrase!(), execution_phrase!(),
paths[1] paths[1]
); );

View file

@ -115,7 +115,7 @@ macro_rules! show_usage_error(
($($args:tt)+) => ({ ($($args:tt)+) => ({
eprint!("{}: ", $crate::util_name!()); eprint!("{}: ", $crate::util_name!());
eprintln!($($args)+); eprintln!($($args)+);
eprintln!("Try `{} --help` for more information.", $crate::execution_phrase!()); eprintln!("Try '{} --help' for more information.", $crate::execution_phrase!());
}) })
); );

View file

@ -104,7 +104,7 @@ pub fn gen_uumain(_args: TokenStream, stream: TokenStream) -> TokenStream {
show_error!("{}", s); show_error!("{}", s);
} }
if e.usage() { if e.usage() {
eprintln!("Try `{} --help` for more information.", execution_phrase!()); eprintln!("Try '{} --help' for more information.", execution_phrase!());
} }
e.code() e.code()
} }

View file

@ -116,7 +116,7 @@ fn test_no_args() {
fn test_no_args_output() { fn test_no_args_output() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
ts.ucmd().fails().stderr_is(&format!( ts.ucmd().fails().stderr_is(&format!(
"{0}: missing operand\nTry `{1} {0} --help` for more information.", "{0}: missing operand\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));
@ -131,7 +131,7 @@ fn test_too_many_args() {
fn test_too_many_args_output() { fn test_too_many_args_output() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
ts.ucmd().args(&["a", "b", "c"]).fails().stderr_is(format!( ts.ucmd().args(&["a", "b", "c"]).fails().stderr_is(format!(
"{0}: extra operand 'c'\nTry `{1} {0} --help` for more information.", "{0}: extra operand 'c'\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -568,7 +568,7 @@ fn test_cp_backup_no_clobber_conflicting_options() {
.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE)
.fails().stderr_is(&format!( .fails().stderr_is(&format!(
"{0}: options --backup and --no-clobber are mutually exclusive\nTry `{1} {0} --help` for more information.", "{0}: options --backup and --no-clobber are mutually exclusive\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -19,7 +19,7 @@ fn test_more_dir_arg() {
let result = ts.ucmd().arg(".").run(); let result = ts.ucmd().arg(".").run();
result.failure(); result.failure();
let expected_error_message = &format!( let expected_error_message = &format!(
"{0}: '.' is a directory.\nTry `{1} {0} --help` for more information.", "{0}: '.' is a directory.\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
); );

View file

@ -529,7 +529,7 @@ fn test_mv_backup_no_clobber_conflicting_options() {
.arg("file1") .arg("file1")
.arg("file2") .arg("file2")
.fails() .fails()
.stderr_is(&format!("{0}: options --backup and --no-clobber are mutually exclusive\nTry `{1} {0} --help` for more information.", .stderr_is(&format!("{0}: options --backup and --no-clobber are mutually exclusive\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -27,7 +27,7 @@ fn test_adjustment_with_no_command_should_error() {
ts.ucmd() ts.ucmd()
.args(&["-n", "19"]) .args(&["-n", "19"])
.run() .run()
.stderr_is(&format!("{0}: A command must be given with an adjustment.\nTry `{1} {0} --help` for more information.\n", .stderr_is(&format!("{0}: A command must be given with an adjustment.\nTry '{1} {0} --help' for more information.\n",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -5,7 +5,7 @@ fn test_rejects_nan() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
ts.ucmd().args(&["NaN"]).fails().stderr_only(format!( ts.ucmd().args(&["NaN"]).fails().stderr_only(format!(
"{0}: invalid 'not-a-number' argument: 'NaN'\nTry `{1} {0} --help` for more information.", "{0}: invalid 'not-a-number' argument: 'NaN'\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));
@ -16,7 +16,7 @@ fn test_rejects_non_floats() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
ts.ucmd().args(&["foo"]).fails().stderr_only(&format!( ts.ucmd().args(&["foo"]).fails().stderr_only(&format!(
"{0}: invalid floating point argument: 'foo'\nTry `{1} {0} --help` for more information.", "{0}: invalid floating point argument: 'foo'\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -59,7 +59,7 @@ fn test_stdbuf_line_buffering_stdin_fails() {
.args(&["-i", "L", "head"]) .args(&["-i", "L", "head"])
.fails() .fails()
.stderr_is(&format!( .stderr_is(&format!(
"{0}: line buffering stdin is meaningless\nTry `{1} {0} --help` for more information.", "{0}: line buffering stdin is meaningless\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));

View file

@ -24,7 +24,7 @@ fn test_unlink_multiple_files() {
at.touch(file_b); at.touch(file_b);
ucmd.arg(file_a).arg(file_b).fails().stderr_is(&format!( ucmd.arg(file_a).arg(file_b).fails().stderr_is(&format!(
"{0}: extra operand: 'test_unlink_multiple_file_b'\nTry `{1} {0} --help` for more information.", "{0}: extra operand: 'test_unlink_multiple_file_b'\nTry '{1} {0} --help' for more information.",
ts.util_name, ts.util_name,
ts.bin_path.to_string_lossy() ts.bin_path.to_string_lossy()
)); ));