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

sort: make GNU test sort-debug-keys pass (#2269)

* sort: disable support for thousand separators

In order to be compatible with GNU, we have to disable thousands
separators. GNU does not enable them for the C locale, either.

Once we add support for locales we can add this feature back.

* sort: delete unused fixtures

* sort: compare -0 and 0 equal

I must have misunderstood this when implementing, but GNU considers
-0, 0, and invalid numbers to be equal.

* sort: strip blanks before applying the char index

* sort: don't crash when key start is after key end

* sort: add "no match" for months at the first non-whitespace char

We should put the "^ no match for key" indicator at the first
non-whitespace character of a field.

* sort: improve support for e notation

* sort: use maches! macros
This commit is contained in:
Michael Debertol 2021-05-28 22:38:29 +02:00 committed by GitHub
parent 9442f26fdb
commit e9656a6c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 191 additions and 231 deletions

View file

@ -526,6 +526,11 @@ fn test_keys_with_options_blanks_start() {
}
}
#[test]
fn test_keys_blanks_with_char_idx() {
test_helper("keys_blanks", &["-k 1.2b"])
}
#[test]
fn test_keys_with_options_blanks_end() {
let input = "a b
@ -574,6 +579,13 @@ aaaa
.stdout_only(input);
}
#[test]
fn test_keys_negative_size_match() {
// If the end of a field is before its start, we should not crash.
// Debug output should report "no match for key" at the start position (i.e. the later position).
test_helper("keys_negative_size", &["-k 3,1"]);
}
#[test]
fn test_zero_terminated() {
test_helper("zero-terminated", &["-z"]);