mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
df: show "total" label in correct column
Show the "total" label in the "source" column or in the "target" column if the "source" column is not visible. Before this commit, $ df --total --output=target . Mounted on / - After this commit, $ df --total --output=target . Mounted on / total
This commit is contained in:
parent
7861cc9dca
commit
d7b528f60b
2 changed files with 73 additions and 14 deletions
|
@ -360,6 +360,47 @@ fn test_total() {
|
|||
assert_eq!(computed_total_avail, reported_total_avail);
|
||||
}
|
||||
|
||||
/// Test that the "total" label appears in the correct column.
|
||||
///
|
||||
/// The "total" label should appear in the "source" column, or in the
|
||||
/// "target" column if "source" is not visible.
|
||||
#[test]
|
||||
fn test_total_label_in_correct_column() {
|
||||
let output = new_ucmd!()
|
||||
.args(&["--output=source", "--total", "."])
|
||||
.succeeds()
|
||||
.stdout_move_str();
|
||||
let last_line = output.lines().last().unwrap();
|
||||
assert_eq!(last_line.trim(), "total");
|
||||
|
||||
let output = new_ucmd!()
|
||||
.args(&["--output=target", "--total", "."])
|
||||
.succeeds()
|
||||
.stdout_move_str();
|
||||
let last_line = output.lines().last().unwrap();
|
||||
assert_eq!(last_line.trim(), "total");
|
||||
|
||||
let output = new_ucmd!()
|
||||
.args(&["--output=source,target", "--total", "."])
|
||||
.succeeds()
|
||||
.stdout_move_str();
|
||||
let last_line = output.lines().last().unwrap();
|
||||
assert_eq!(
|
||||
last_line.split_whitespace().collect::<Vec<&str>>(),
|
||||
vec!["total", "-"]
|
||||
);
|
||||
|
||||
let output = new_ucmd!()
|
||||
.args(&["--output=target,source", "--total", "."])
|
||||
.succeeds()
|
||||
.stdout_move_str();
|
||||
let last_line = output.lines().last().unwrap();
|
||||
assert_eq!(
|
||||
last_line.split_whitespace().collect::<Vec<&str>>(),
|
||||
vec!["-", "total"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_use_percentage() {
|
||||
let output = new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue