Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -2816,7 +2816,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
11 changes: 10 additions & 1 deletion tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,19 @@ 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() {
new_ucmd!()
.pipe_in("1\n2e3\n1e-5")
.arg("-g")
.succeeds()
.stdout_only("1e-5\n1\n2e3\n");
}

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
12 changes: 0 additions & 12 deletions tests/fixtures/sort/exponents-positive-general.expected

This file was deleted.

12 changes: 0 additions & 12 deletions tests/fixtures/sort/exponents-positive-general.txt

This file was deleted.

Loading