Use Debug over Display to fix parse test

This commit is contained in:
Richard Feldman 2021-12-02 08:57:44 -05:00 committed by GitHub
parent 23c0ab0170
commit 44bb5d0645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -488,7 +488,12 @@ mod test_parse {
#[quickcheck] #[quickcheck]
fn all_f64_values_parse(num: f64) { fn all_f64_values_parse(num: f64) {
assert_parses_to(num.to_string().as_str(), Float(num.to_string().as_str())); // 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.
let float_string = format!("{:?}", num);
assert_parses_to(float_string.as_str(), Float(float_string.as_str()));
} }
// SINGLE QUOTE LITERAL // SINGLE QUOTE LITERAL