mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-05 15:37:47 +00:00
Merge branch 'main' into rm-correct-prompts
This commit is contained in:
commit
c4417bf9b2
27 changed files with 145 additions and 32 deletions
25
Cargo.lock
generated
25
Cargo.lock
generated
|
@ -1145,9 +1145,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.135"
|
version = "0.2.136"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
|
checksum = "55edcf6c0bb319052dea84732cf99db461780fd5e8d3eb46ab6ff312ab31f197"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
|
@ -2076,21 +2076,32 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.15"
|
version = "0.3.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c"
|
checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"libc",
|
"libc",
|
||||||
"num_threads",
|
"num_threads",
|
||||||
|
"serde",
|
||||||
|
"time-core",
|
||||||
"time-macros",
|
"time-macros",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-macros"
|
name = "time-core"
|
||||||
version = "0.2.4"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
|
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-macros"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b"
|
||||||
|
dependencies = [
|
||||||
|
"time-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/chmod.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs", "mode"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs", "mode"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -246,6 +246,19 @@ fn parse_spec(spec: &str, sep: char) -> UResult<(Option<u32>, Option<u32>)> {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if user.chars().next().map(char::is_numeric).unwrap_or(false)
|
||||||
|
&& group.is_empty()
|
||||||
|
&& spec != user
|
||||||
|
{
|
||||||
|
// if the arg starts with an id numeric value, the group isn't set but the separator is provided,
|
||||||
|
// we should fail with an error
|
||||||
|
return Err(USimpleError::new(
|
||||||
|
1,
|
||||||
|
format!("invalid spec: {}", spec.quote()),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
Ok((uid, gid))
|
Ok((uid, gid))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ path = "src/cp.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
filetime = "0.2"
|
filetime = "0.2"
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
quick-error = "2.0.1"
|
quick-error = "2.0.1"
|
||||||
selinux = { version="0.3", optional=true }
|
selinux = { version="0.3", optional=true }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }
|
||||||
|
|
|
@ -278,8 +278,8 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|
||||||
let tag = matches.get_flag("tag");
|
let tag = matches.get_flag("tag");
|
||||||
let nonames = *matches
|
let nonames = *matches
|
||||||
.try_get_one("no-names")
|
.try_get_one("no-names")
|
||||||
.unwrap_or(Some(&false))
|
.unwrap_or(None)
|
||||||
.unwrap();
|
.unwrap_or(&false);
|
||||||
let status = matches.get_flag("status");
|
let status = matches.get_flag("status");
|
||||||
let quiet = matches.get_flag("quiet") || status;
|
let quiet = matches.get_flag("quiet") || status;
|
||||||
let strict = matches.get_flag("strict");
|
let strict = matches.get_flag("strict");
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/hostid.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -15,7 +15,7 @@ edition = "2021"
|
||||||
path = "src/logname.rs"
|
path = "src/logname.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/mkfifo.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -17,7 +17,7 @@ path = "src/mknod.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "^0.2.135"
|
libc = "^0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["mode"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["mode"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/nice.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
nix = { version = "0.25", default-features = false }
|
nix = { version = "0.25", default-features = false }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/nohup.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
atty = "0.2"
|
atty = "0.2"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ edition = "2021"
|
||||||
path = "src/nproc.rs"
|
path = "src/nproc.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
num_cpus = "1.10"
|
num_cpus = "1.10"
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
||||||
|
|
|
@ -272,14 +272,13 @@ fn transform_to(
|
||||||
let (i2, s) = consider_suffix(s, &opts.to, round_method, precision)?;
|
let (i2, s) = consider_suffix(s, &opts.to, round_method, precision)?;
|
||||||
let i2 = i2 / (opts.to_unit as f64);
|
let i2 = i2 / (opts.to_unit as f64);
|
||||||
Ok(match s {
|
Ok(match s {
|
||||||
None if precision > 0 => {
|
None => {
|
||||||
format!(
|
format!(
|
||||||
"{:.precision$}",
|
"{:.precision$}",
|
||||||
round_with_precision(i2, round_method, precision),
|
round_with_precision(i2, round_method, precision),
|
||||||
precision = precision
|
precision = precision
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => format!("{}", i2),
|
|
||||||
Some(s) if precision > 0 => {
|
Some(s) if precision > 0 => {
|
||||||
format!(
|
format!(
|
||||||
"{:.precision$}{}",
|
"{:.precision$}{}",
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/pathchk.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -126,7 +126,10 @@ fn logical_path() -> io::Result<PathBuf> {
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let matches = uu_app().try_get_matches_from(args)?;
|
let matches = uu_app().try_get_matches_from(args)?;
|
||||||
let cwd = if matches.get_flag(OPT_LOGICAL) {
|
// if POSIXLY_CORRECT is set, we want to a logical resolution.
|
||||||
|
// This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd
|
||||||
|
// We should get c in this case instead of a/b at the end of the path
|
||||||
|
let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() {
|
||||||
logical_path()
|
logical_path()
|
||||||
} else {
|
} else {
|
||||||
physical_path()
|
physical_path()
|
||||||
|
|
|
@ -17,7 +17,7 @@ path = "src/rmdir.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "rmdir"
|
name = "rmdir"
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/sync.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["wide"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["wide"] }
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||||
|
|
|
@ -17,7 +17,7 @@ path = "src/tail.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
memchr = "2.5.0"
|
memchr = "2.5.0"
|
||||||
notify = { version = "=5.0.0", features=["macos_kqueue"]}
|
notify = { version = "=5.0.0", features=["macos_kqueue"]}
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] }
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/tee.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
retain_mut = "=0.1.7" # ToDO: [2021-01-01; rivy; maint/MinSRV] ~ v0.1.5 uses const generics which aren't stabilized until rust v1.51.0
|
retain_mut = "=0.1.7" # ToDO: [2021-01-01; rivy; maint/MinSRV] ~ v0.1.5 uses const generics which aren't stabilized until rust v1.51.0
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["libc"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["libc"] }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/test.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
[target.'cfg(target_os = "redox")'.dependencies]
|
[target.'cfg(target_os = "redox")'.dependencies]
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/timeout.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
nix = { version = "0.25", default-features = false, features = ["signal"] }
|
nix = { version = "0.25", default-features = false, features = ["signal"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["process", "signals"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["process", "signals"] }
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=[
|
||||||
windows-sys = { version = "0.42.0", default-features = false, features = ["Win32_NetworkManagement_NetManagement", "Win32_System_WindowsProgramming", "Win32_Foundation"] }
|
windows-sys = { version = "0.42.0", default-features = false, features = ["Win32_NetworkManagement_NetManagement", "Win32_System_WindowsProgramming", "Win32_Foundation"] }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "whoami"
|
name = "whoami"
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/yes.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.135"
|
libc = "0.2.136"
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["pipes"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["pipes"] }
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||||
|
|
|
@ -32,7 +32,7 @@ time = { version="0.3", optional=true, features = ["formatting", "local-offset",
|
||||||
data-encoding = { version="2.1", optional=true }
|
data-encoding = { version="2.1", optional=true }
|
||||||
data-encoding-macro = { version="0.1.12", optional=true }
|
data-encoding-macro = { version="0.1.12", optional=true }
|
||||||
z85 = { version="3.0.5", optional=true }
|
z85 = { version="3.0.5", optional=true }
|
||||||
libc = { version="0.2.135", optional=true }
|
libc = { version="0.2.136", optional=true }
|
||||||
once_cell = "1.13.1"
|
once_cell = "1.13.1"
|
||||||
os_display = "0.1.3"
|
os_display = "0.1.3"
|
||||||
|
|
||||||
|
|
|
@ -423,6 +423,38 @@ fn test_chown_only_user_id() {
|
||||||
.stderr_contains("failed to change");
|
.stderr_contains("failed to change");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_chown_fail_id() {
|
||||||
|
// test chown 1111. file.txt
|
||||||
|
|
||||||
|
let scene = TestScenario::new(util_name!());
|
||||||
|
let at = &scene.fixtures;
|
||||||
|
|
||||||
|
let result = scene.cmd_keepenv("id").arg("-u").run();
|
||||||
|
if skipping_test_is_okay(&result, "id: cannot find name for group ID") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let user_id = String::from(result.stdout_str().trim());
|
||||||
|
assert!(!user_id.is_empty());
|
||||||
|
|
||||||
|
let file1 = "test_chown_file1";
|
||||||
|
at.touch(file1);
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.arg(format!("{}:", user_id))
|
||||||
|
.arg(file1)
|
||||||
|
.fails()
|
||||||
|
.stderr_contains("invalid spec");
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.arg(format!("{}.", user_id))
|
||||||
|
.arg(file1)
|
||||||
|
.fails()
|
||||||
|
.stderr_contains("invalid spec");
|
||||||
|
}
|
||||||
|
|
||||||
/// Test for setting the owner to a user ID for a user that does not exist.
|
/// Test for setting the owner to a user ID for a user that does not exist.
|
||||||
///
|
///
|
||||||
/// For example:
|
/// For example:
|
||||||
|
|
|
@ -530,7 +530,7 @@ fn test_round() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&[
|
.args(&[
|
||||||
"--to=si",
|
"--to=si",
|
||||||
&format!("--round={}", method),
|
&format!("--round={method}"),
|
||||||
"--",
|
"--",
|
||||||
"9001",
|
"9001",
|
||||||
"-9001",
|
"-9001",
|
||||||
|
@ -542,6 +542,32 @@ fn test_round() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_round_with_to_unit() {
|
||||||
|
for (method, exp) in [
|
||||||
|
("from-zero", ["6", "-6", "5.9", "-5.9", "5.86", "-5.86"]),
|
||||||
|
("towards-zero", ["5", "-5", "5.8", "-5.8", "5.85", "-5.85"]),
|
||||||
|
("up", ["6", "-5", "5.9", "-5.8", "5.86", "-5.85"]),
|
||||||
|
("down", ["5", "-6", "5.8", "-5.9", "5.85", "-5.86"]),
|
||||||
|
("nearest", ["6", "-6", "5.9", "-5.9", "5.86", "-5.86"]),
|
||||||
|
] {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&[
|
||||||
|
"--to-unit=1024",
|
||||||
|
&format!("--round={method}"),
|
||||||
|
"--",
|
||||||
|
"6000",
|
||||||
|
"-6000",
|
||||||
|
"6000.0",
|
||||||
|
"-6000.0",
|
||||||
|
"6000.00",
|
||||||
|
"-6000.00",
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only(exp.join("\n") + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_suffix_is_added_if_not_supplied() {
|
fn test_suffix_is_added_if_not_supplied() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
|
@ -90,6 +90,35 @@ fn test_symlinked_default() {
|
||||||
env.ucmd.succeeds().stdout_is(env.subdir + "\n");
|
env.ucmd.succeeds().stdout_is(env.subdir + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_symlinked_default_posix() {
|
||||||
|
let mut env = symlinked_env();
|
||||||
|
env.ucmd
|
||||||
|
.env("POSIXLY_CORRECT", "1")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is(env.symdir.clone() + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_symlinked_default_posix_l() {
|
||||||
|
let mut env = symlinked_env();
|
||||||
|
env.ucmd
|
||||||
|
.env("POSIXLY_CORRECT", "1")
|
||||||
|
.arg("-L")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is(env.symdir + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_symlinked_default_posix_p() {
|
||||||
|
let mut env = symlinked_env();
|
||||||
|
env.ucmd
|
||||||
|
.env("POSIXLY_CORRECT", "1")
|
||||||
|
.arg("-P")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is(env.symdir + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
pub mod untrustworthy_pwd_var {
|
pub mod untrustworthy_pwd_var {
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue