From 9b525b4aba20578df3ac77725bde5a8ad4fe7b86 Mon Sep 17 00:00:00 2001 From: sholderbach Date: Sun, 19 Jan 2025 19:13:16 +0100 Subject: [PATCH] Add test documenting that whitespace is not a valid digit separator More following the old choices of using `f64::from_str` Signed-off-by: sholderbach --- src/parse.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/parse.rs b/src/parse.rs index 3468829..218fe8b 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -220,6 +220,9 @@ mod tests { assert!(parse("a124GB").is_err()); assert!(parse("1.3 42.0 B").is_err()); assert!(parse("1.3 ... B").is_err()); + // The original implementation did not account for the possibility that users may + // use whitespace to visually separate digits, thus treat it as an error + assert!(parse("1 000 B").is_err()); } #[test]