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

Merge pull request #6535 from sylvestre/sort

sort: improve the error mgmt with --batch-size
This commit is contained in:
Daniel Hofstetter 2024-07-05 09:45:54 +02:00 committed by GitHub
commit b774000351
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 124 additions and 11 deletions

View file

@ -1036,6 +1036,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!())