mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
df: simplify get_header() in test_block_size_1024
This commit is contained in:
parent
5088ddc377
commit
78dc90124e
1 changed files with 2 additions and 10 deletions
|
@ -378,19 +378,11 @@ fn test_iuse_percentage() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_block_size_1024() {
|
fn test_block_size_1024() {
|
||||||
fn get_header(block_size: u64) -> String {
|
fn get_header(block_size: u64) -> String {
|
||||||
// TODO When #3057 is resolved, we should just use
|
|
||||||
//
|
|
||||||
// new_ucmd!().arg("--output=size").succeeds().stdout_move_str();
|
|
||||||
//
|
|
||||||
// instead of parsing the entire `df` table as a string.
|
|
||||||
let output = new_ucmd!()
|
let output = new_ucmd!()
|
||||||
.args(&["-B", &format!("{}", block_size)])
|
.args(&["-B", &format!("{}", block_size), "--output=size"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_move_str();
|
.stdout_move_str();
|
||||||
let first_line = output.lines().next().unwrap();
|
output.lines().next().unwrap().to_string()
|
||||||
let mut column_labels = first_line.split_whitespace();
|
|
||||||
let size_column_label = column_labels.nth(1).unwrap();
|
|
||||||
size_column_label.into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(get_header(1024), "1K-blocks");
|
assert_eq!(get_header(1024), "1K-blocks");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue