Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sort: Added integration tests for buffer-size flag
Browse files Browse the repository at this point in the history
sallto committed Oct 19, 2022
1 parent 1efaccd commit 128be3b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ fn test_helper(file_name: &str, possible_args: &[&str]) {

#[test]
fn test_buffer_sizes() {
let buffer_sizes = ["0", "50K", "50k", "1M", "100M"];
let buffer_sizes = ["0", "50K", "50k", "1M", "100M", "10%", "100%"];
for buffer_size in &buffer_sizes {
TestScenario::new(util_name!())
.ucmd_keepenv()
@@ -63,13 +63,27 @@ fn test_invalid_buffer_size() {
.code_is(2)
.stderr_only("sort: invalid --buffer-size argument 'asd'");

new_ucmd!()
.arg("-S")
.arg("%")
.fails()
.code_is(2)
.stderr_only("sort: invalid --buffer-size argument '%'");

new_ucmd!()
.arg("-S")
.arg("100f")
.fails()
.code_is(2)
.stderr_only("sort: invalid suffix in --buffer-size argument '100f'");

new_ucmd!()
.arg("-S")
.arg("101%")
.fails()
.code_is(2)
.stderr_only("sort: --buffer-size argument '101%' too large");

#[cfg(not(target_pointer_width = "128"))]
new_ucmd!()
.arg("-n")

0 comments on commit 128be3b

Please sign in to comment.