1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

sort: improve the error mgmt with --batch-size

should make the gnu test tests/sort/sort-merge.pl pass
This commit is contained in:
Sylvestre Ledru 2024-07-04 01:19:48 +02:00
parent 69b603bfe7
commit e2c66ea092
7 changed files with 124 additions and 11 deletions

View file

@ -1035,6 +1035,38 @@ fn test_merge_batches() {
.stdout_only_fixture("ext_sort.expected");
}
#[test]
fn test_batch_size_invalid() {
TestScenario::new(util_name!())
.ucmd()
.arg("--batch-size=0")
.fails()
.code_is(2)
.stderr_contains("sort: invalid --batch-size argument '0'")
.stderr_contains("sort: minimum --batch-size argument is '2'");
}
#[test]
fn test_batch_size_too_large() {
let large_batch_size = "18446744073709551616";
TestScenario::new(util_name!())
.ucmd()
.arg(format!("--batch-size={}", large_batch_size))
.fails()
.code_is(2)
.stderr_contains(format!(
"--batch-size argument '{}' too large",
large_batch_size
));
#[cfg(target_os = "linux")]
TestScenario::new(util_name!())
.ucmd()
.arg(format!("--batch-size={}", large_batch_size))
.fails()
.code_is(2)
.stderr_contains("maximum --batch-size argument with current rlimit is");
}
#[test]
fn test_merge_batch_size() {
TestScenario::new(util_name!())