Merge pull request #393 from dtolnay/nansign

Add test of NaN sign when deserializing to primitive
This commit is contained in:
David Tolnay 2023-10-25 20:26:31 -07:00 committed by GitHub
commit d07a63c724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -15,7 +15,7 @@ rust-version = "1.64"
indexmap = "2"
itoa = "1.0"
ryu = "1.0"
serde = "1.0.139"
serde = "1.0.190"
unsafe-libyaml = "0.2.7"
[dev-dependencies]

View File

@ -450,6 +450,13 @@ fn test_numbers() {
}
}
#[test]
fn test_nan() {
// There is no negative NaN in YAML.
assert!(serde_yaml::from_str::<f32>(".nan").unwrap().is_sign_positive());
assert!(serde_yaml::from_str::<f64>(".nan").unwrap().is_sign_positive());
}
#[test]
fn test_stateful() {
struct Seed(i64);