From 5ad14553fd1b3bdd8b170b8cac63dba75e7e51d8 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 12 Dec 2021 22:11:18 -0500 Subject: [PATCH] Handle non-finite floats in test --- compiler/parse/tests/test_parse.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/parse/tests/test_parse.rs b/compiler/parse/tests/test_parse.rs index 1c0dc0b64b..58afaaff76 100644 --- a/compiler/parse/tests/test_parse.rs +++ b/compiler/parse/tests/test_parse.rs @@ -487,7 +487,12 @@ mod test_parse { } #[quickcheck] - fn all_f64_values_parse(num: f64) { + fn all_f64_values_parse(mut num: f64) { + // NaN, Infinity, -Infinity (these would all parse as tags in Roc) + if !num.is_finite() { + num = 0.0; + } + // These can potentially be whole numbers. `Display` omits the decimal point for those, // causing them to no longer be parsed as fractional numbers by Roc. // Using `Debug` instead of `Display` ensures they always have a decimal point.