Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #393 from dtolnay/nansign
Browse files Browse the repository at this point in the history
Add test of NaN sign when deserializing to primitive
  • Loading branch information
dtolnay authored Oct 26, 2023
2 parents d094ba1 + 13e2610 commit d07a63c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 7 additions & 0 deletions tests/test_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d07a63c

Please sign in to comment.