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

Merge pull request #3522 from cakebaker/add_missing_default_blocksize_test

df: test default blocksize in POSIX mode
This commit is contained in:
Sylvestre Ledru 2022-05-13 18:47:29 +02:00 committed by GitHub
commit 8891571e9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -435,6 +435,30 @@ fn test_default_block_size() {
assert_eq!(header, "512B-blocks");
}
#[test]
fn test_default_block_size_in_posix_portability_mode() {
fn get_header(s: &str) -> String {
s.lines()
.next()
.unwrap()
.to_string()
.split_whitespace()
.nth(1)
.unwrap()
.to_string()
}
let output = new_ucmd!().arg("-P").succeeds().stdout_move_str();
assert_eq!(get_header(&output), "1024-blocks");
let output = new_ucmd!()
.arg("-P")
.env("POSIXLY_CORRECT", "1")
.succeeds()
.stdout_move_str();
assert_eq!(get_header(&output), "512-blocks");
}
#[test]
fn test_block_size_1024() {
fn get_header(block_size: u64) -> String {