diff options
author | Daniel Hofstetter <daniel.hofstetter@42dh.com> | 2024-07-05 09:45:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-05 09:45:54 +0200 |
commit | b774000351e3b4b28c1a518772cacb3d3a0255bf (patch) | |
tree | b12e64c26d95801fce72157f2c53e685e21e5766 /tests/by-util | |
parent | 1e80d3e3b2d4f3ad38733cb44fedc388f6c878e9 (diff) | |
parent | e2c66ea0923ac41599ab2602e801fd0609346b11 (diff) |
Merge pull request #6535 from sylvestre/sort
sort: improve the error mgmt with --batch-size
Diffstat (limited to 'tests/by-util')
-rw-r--r-- | tests/by-util/test_sort.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 7308f243a..42a877e4e 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1037,6 +1037,38 @@ fn test_merge_batches() { } #[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!()) .ucmd() |