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

sort: make merging stable

When merging files we need to prioritize files that occur earlier in the
command line arguments with -m.

This also makes the extsort merge step (and thus extsort itself) stable again.
This commit is contained in:
Michael Debertol 2021-05-08 23:06:17 +02:00
parent 2ff9cc6570
commit e0ebf907a4
7 changed files with 48 additions and 1 deletions

View file

@ -51,6 +51,18 @@ fn test_smaller_than_specified_segment() {
.stdout_is_fixture("ext_sort.expected");
}
#[test]
fn test_ext_sort_stable() {
new_ucmd!()
.arg("-n")
.arg("--stable")
.arg("-S")
.arg("0M")
.arg("ext_stable.txt")
.succeeds()
.stdout_only_fixture("ext_stable.expected");
}
#[test]
fn test_extsort_zero_terminated() {
new_ucmd!()
@ -566,6 +578,18 @@ fn test_merge_unique() {
.stdout_only_fixture("merge_ints_interleaved.expected");
}
#[test]
fn test_merge_stable() {
new_ucmd!()
.arg("-m")
.arg("--stable")
.arg("-n")
.arg("merge_stable_1.txt")
.arg("merge_stable_2.txt")
.succeeds()
.stdout_only_fixture("merge_stable.expected");
}
#[test]
fn test_merge_reversed() {
new_ucmd!()