numfmt: respect --invalid mode when rejecting scientific notation (#11945)

* fix #11935

* code style and error message

* cargo fmt

* add test for issue 11935

* Update test_numfmt.rs

* check for the expected output in test
This commit is contained in:
Devel08
2026-04-23 17:29:40 +02:00
committed by GitHub
parent 22bd03668a
commit d836730024
2 changed files with 34 additions and 14 deletions
+11
View File
@@ -1513,3 +1513,14 @@ fn test_locale_c_uses_period() {
.succeeds()
.stdout_is("1.5K\n");
}
// https://github.com/uutils/coreutils/issues/11935
// the rejection path bypasses --invalid=warn/ignore/fail handling
#[test]
fn test_ignores_invalid_mode_issue11935() {
new_ucmd!()
.args(&["--invalid=warn", "100", "1e5", "200"])
.succeeds()
.stderr_is("numfmt: invalid suffix in input: '1e5'\n")
.stdout_is("100\n1e5\n200\n");
}