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

Add test of NaN sign when deserializing to primitive #393

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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