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

install: support when a hyphen is passed (#5697)

* install: support when a hyphen is passed

Should fix: tests/install/strip-program.sh

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Sylvestre Ledru 2023-12-23 15:29:32 +01:00 committed by GitHub
parent 6b1f51385f
commit 2832694056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 1 deletions

View file

@ -674,6 +674,34 @@ fn test_install_and_strip_with_program() {
assert!(!stdout.contains(STRIP_SOURCE_FILE_SYMBOL));
}
#[cfg(all(unix, feature = "chmod"))]
#[test]
// FixME: Freebsd fails on 'No such file or directory'
#[cfg(not(target_os = "freebsd"))]
fn test_install_and_strip_with_program_hyphen() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let content = r#"#!/bin/sh
echo $1 &> /tmp/a.log
printf -- '%s\n' "$1" | grep '^[^-]'
"#;
at.write("no-hyphen", content);
scene.ccmd("chmod").arg("+x").arg("no-hyphen").succeeds();
at.touch("src");
scene
.ucmd()
.arg("-s")
.arg("--strip-program")
.arg("./no-hyphen")
.arg("--")
.arg("src")
.arg("-dest")
.succeeds()
.no_stderr();
}
#[test]
#[cfg(not(windows))]
fn test_install_and_strip_with_invalid_program() {