-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
sort:Align sort debug key annotations with GNU coreutils #9468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattsu2020
wants to merge
8
commits into
uutils:main
Choose a base branch
from
mattsu2020:sort-debug-keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replaced direct length checks with filtered counts excluding b'\0' in debug underline and indentation output to prevent misalignment from embedded NUL characters, which are often stripped during inspection. Added comprehensive tests for various sort modes and inputs, including NUL byte scenarios, to verify correct debug annotations.
Split the existing `test_debug_key_annotations` into two tests: one for basic functionality and another for locale-specific behavior to handle conditional execution based on environment variables. Extracted a new helper function `debug_key_annotation_output` to generate debug output, improving test modularity and reducing code duplication. This enhances test coverage for debug key annotations in different numeric locales.
|
GNU testsuite comparison: |
…ut for efficiency Rework the `number` helper function to use a mutable String buffer with `writeln!` macro instead of collecting intermediary vectors with `map` and `collect`. This reduces allocations and improves performance in test output generation, building the numbered output directly without extra string concatenations.
- Reformatted command-line arguments in test_debug_key_annotations_locale to fit on fewer lines - Wrapped run_sort calls in debug_key_annotation_output for better code structure - Minor reordering of output.push_str blocks for consistency and clarity
Replace fixture file reads with inline constants in test functions for debug key annotations and locale variants. This makes the tests more self-contained by removing dependencies on external fixture files.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Add comprehensive fixture files for sort --debug key annotation output, including locale-specific expectations.
Refactor tests to share a helper and split locale-aware coverage, matching GNU sort’s behavior.
Ensure “no match for key” annotations render identically to the reference shell script.
related
#9127