Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ fn get_leading_gen(inp: &[u8], decimal_pt: u8) -> Range<usize> {
if let Some(&(_, &next_char)) = char_indices.peek() {
if (next_char == b'+' || next_char == b'-')
&& matches!(
char_indices.peek_nth(2),
char_indices.peek_nth(1),
Some((_, c)) if c.is_ascii_digit()
)
{
Expand Down
7 changes: 6 additions & 1 deletion tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,15 @@ fn test_non_printing_chars() {
}

#[test]
fn test_exponents_positive_general_fixed() {
fn test_exponents_general() {
test_helper("exponents_general", &["-g"]);
}

#[test]
fn test_exponents_positive_general() {
test_helper("exponents-positive-general", &["-g"]);
}

Comment on lines +485 to +493

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a fan of this test (and the fixtures/sort files)
please test this way:
printf '1\n1e-5' | sort -g

#[test]
fn test_exponents_positive_numeric() {
test_helper(
Expand Down
36 changes: 36 additions & 0 deletions tests/fixtures/sort/exponents-positive-general.expected.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

^ no match for key
^ no match for key

^ no match for key
^ no match for key

^ no match for key
^ no match for key

^ no match for key
^ no match for key

^ no match for key
^ no match for key

^ no match for key
^ no match for key
10E
__
___
1000EDKLD
____
_________
10000K78
_____
________
+100000
_______
_______
100E6
_____
_____
50e10
_____
_____
Loading