Skip to content

Commit

Permalink
Merge pull request #6437 from cakebaker/df_fix_incorrect_test
Browse files Browse the repository at this point in the history
df: fix incorrect test & add another test
  • Loading branch information
sylvestre committed May 27, 2024
2 parents 22588a8 + 8d3181f commit 8adeb90
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/by-util/test_df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,28 @@ fn test_default_headers() {
}

#[test]
fn test_precedence_of_human_readable_header_over_output_header() {
fn test_precedence_of_human_readable_and_si_header_over_output_header() {
let args = ["-h", "--human-readable", "-H", "--si"];

for arg in args {
let output = new_ucmd!()
.args(&[arg, "--output=size"])
.succeeds()
.stdout_move_str();
let header = output.lines().next().unwrap();
assert_eq!(header, " Size");
}
}

#[test]
fn test_used_header_starts_with_space() {
let output = new_ucmd!()
.args(&["-H", "--output=size"])
// using -h here to ensure the width of the column's content is <= 4
.args(&["-h", "--output=used"])
.succeeds()
.stdout_move_str();
let header = output.lines().next().unwrap().to_string();
assert_eq!(header.trim(), "Size");
let header = output.lines().next().unwrap();
assert_eq!(header, " Used");
}

#[test]
Expand Down

0 comments on commit 8adeb90

Please sign in to comment.