mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-16 19:56:17 +00:00
Merge branch 'main' of github.com:uutils/coreutils into hbina-test_ls_order_time-is-flaky
This commit is contained in:
commit
c4c666814b
22 changed files with 268 additions and 50 deletions
|
@ -179,15 +179,15 @@ fn test_du_hard_link() {
|
|||
|
||||
#[cfg(target_vendor = "apple")]
|
||||
fn _du_hard_link(s: &str) {
|
||||
assert_eq!(s, "12\tsubdir/links\n")
|
||||
assert_eq!(s, "12\tsubdir/links\n");
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
fn _du_hard_link(s: &str) {
|
||||
assert_eq!(s, "8\tsubdir/links\n")
|
||||
assert_eq!(s, "8\tsubdir/links\n");
|
||||
}
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn _du_hard_link(s: &str) {
|
||||
assert_eq!(s, "16\tsubdir/links\n")
|
||||
assert_eq!(s, "16\tsubdir/links\n");
|
||||
}
|
||||
#[cfg(all(
|
||||
not(target_vendor = "apple"),
|
||||
|
|
|
@ -219,7 +219,7 @@ fn test_change_directory() {
|
|||
.args(&pwd)
|
||||
.succeeds()
|
||||
.stdout_move_str();
|
||||
assert_eq!(out.trim(), temporary_path.as_os_str())
|
||||
assert_eq!(out.trim(), temporary_path.as_os_str());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,6 +1,53 @@
|
|||
use crate::common::util::*;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
||||
use std::fs::OpenOptions;
|
||||
|
||||
#[test]
|
||||
fn test_exit_code() {
|
||||
new_ucmd!().fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!()
|
||||
.args(&["--version"])
|
||||
.fails()
|
||||
.stdout_contains("false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_help() {
|
||||
new_ucmd!()
|
||||
.args(&["--help"])
|
||||
.fails()
|
||||
.stdout_contains("false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_short_options() {
|
||||
for option in ["-h", "-V"] {
|
||||
new_ucmd!().arg(option).fails().stdout_is("");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_conflict() {
|
||||
new_ucmd!()
|
||||
.args(&["--help", "--version"])
|
||||
.fails()
|
||||
.stdout_is("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
||||
fn test_full() {
|
||||
for option in ["--version", "--help"] {
|
||||
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
|
||||
|
||||
new_ucmd!()
|
||||
.arg(option)
|
||||
.set_stdout(dev_full)
|
||||
.fails()
|
||||
.stderr_contains("No space left on device");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,53 @@
|
|||
use crate::common::util::*;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
||||
use std::fs::OpenOptions;
|
||||
|
||||
#[test]
|
||||
fn test_exit_code() {
|
||||
new_ucmd!().succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!()
|
||||
.args(&["--version"])
|
||||
.succeeds()
|
||||
.stdout_contains("true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_help() {
|
||||
new_ucmd!()
|
||||
.args(&["--help"])
|
||||
.succeeds()
|
||||
.stdout_contains("true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_short_options() {
|
||||
for option in ["-h", "-V"] {
|
||||
new_ucmd!().arg(option).succeeds().stdout_is("");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_conflict() {
|
||||
new_ucmd!()
|
||||
.args(&["--help", "--version"])
|
||||
.succeeds()
|
||||
.stdout_is("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
||||
fn test_full() {
|
||||
for option in ["--version", "--help"] {
|
||||
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
|
||||
|
||||
new_ucmd!()
|
||||
.arg(option)
|
||||
.set_stdout(dev_full)
|
||||
.fails()
|
||||
.stderr_contains("No space left on device");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,11 +250,24 @@ fn test_size_and_reference() {
|
|||
#[test]
|
||||
fn test_error_filename_only() {
|
||||
// truncate: you must specify either '--size' or '--reference'
|
||||
new_ucmd!().args(&["file"]).fails().stderr_contains(
|
||||
"error: The following required arguments were not provided:
|
||||
new_ucmd!()
|
||||
.args(&["file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains(
|
||||
"error: The following required arguments were not provided:
|
||||
--reference <RFILE>
|
||||
--size <SIZE>",
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_option() {
|
||||
// truncate: cli parsing error returns 1
|
||||
new_ucmd!()
|
||||
.args(&["--this-arg-does-not-exist"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue