Skip to content

Commit b1ca6c7

Browse files
committed
Add test of as_f64 on large number
Closes #710.
1 parent d6eae8f commit b1ca6c7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎tests/test.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,17 @@ fn test_parse_f64() {
912912
]);
913913
}
914914

915+
#[test]
916+
fn test_value_as_f64() {
917+
let v = serde_json::from_str::<Value>("1e1000");
918+
919+
#[cfg(not(feature = "arbitrary_precision"))]
920+
assert!(v.is_err());
921+
922+
#[cfg(feature = "arbitrary_precision")]
923+
assert_eq!(v.unwrap().as_f64(), None);
924+
}
925+
915926
// Test roundtrip with some values that were not perfectly roundtripped by the
916927
// old f64 deserializer.
917928
#[cfg(feature = "float_roundtrip")]

0 commit comments

Comments
 (0)