diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 52247c4feff..4ea294ee6de 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -2816,7 +2816,7 @@ fn get_leading_gen(inp: &[u8], decimal_pt: u8) -> Range { 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() ) { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 42cbcff5ad4..34a80636f51 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -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"); +} + #[test] fn test_exponents_positive_numeric() { test_helper( diff --git a/tests/fixtures/sort/exponents-positive-general.expected b/tests/fixtures/sort/exponents-positive-general.expected deleted file mode 100644 index 3dbc92fe5cc..00000000000 --- a/tests/fixtures/sort/exponents-positive-general.expected +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -10E -1000EDKLD -10000K78 -+100000 -100E6 -50e10 diff --git a/tests/fixtures/sort/exponents-positive-general.txt b/tests/fixtures/sort/exponents-positive-general.txt deleted file mode 100644 index 23ea527718a..00000000000 --- a/tests/fixtures/sort/exponents-positive-general.txt +++ /dev/null @@ -1,12 +0,0 @@ -10000K78 -10E - - -1000EDKLD - - -100E6 - -50e10 -+100000 -