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

df: -h -H shouldn't cause an error #3366

This commit is contained in:
gmnsii 2022-04-16 07:51:24 -07:00
parent c2e214bd99
commit 85d113ab79
No known key found for this signature in database
GPG key ID: 195F9D85E1627FF3
2 changed files with 24 additions and 2 deletions

View file

@ -26,6 +26,12 @@ fn test_df_compatible_si() {
new_ucmd!().arg("-aH").succeeds();
}
#[test]
fn test_df_overriding() {
new_ucmd!().arg("-hH").succeeds();
new_ucmd!().arg("-Hh").succeeds();
}
#[test]
fn test_df_output() {
let expected = if cfg!(target_os = "macos") {
@ -42,6 +48,22 @@ fn test_df_output() {
assert_eq!(actual, expected);
}
#[test]
fn test_df_output_overridden() {
let expected = if cfg!(target_os = "macos") {
"Filesystem Size Used Available Capacity Use% Mounted on "
} else {
"Filesystem Size Used Available Use% Mounted on "
};
let output = new_ucmd!()
.arg("-hH")
.arg("--total")
.succeeds()
.stdout_move_str();
let actual = output.lines().take(1).collect::<Vec<&str>>()[0];
assert_eq!(actual, expected);
}
#[test]
fn test_total_option_with_single_dash() {
// These should fail because `-total` should have two dashes,