diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/serde_json/tests/regression | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/serde_json/tests/regression')
4 files changed, 18 insertions, 3 deletions
diff --git a/third_party/rust/serde_json/tests/regression/issue1004.rs b/third_party/rust/serde_json/tests/regression/issue1004.rs new file mode 100644 index 0000000000..c09fb96108 --- /dev/null +++ b/third_party/rust/serde_json/tests/regression/issue1004.rs @@ -0,0 +1,12 @@ +#![cfg(feature = "arbitrary_precision")] + +#[test] +fn test() { + let float = 5.55f32; + let value = serde_json::to_value(float).unwrap(); + let json = serde_json::to_string(&value).unwrap(); + + // If the f32 were cast to f64 by Value before serialization, then this + // would incorrectly serialize as 5.550000190734863. + assert_eq!(json, "5.55"); +} diff --git a/third_party/rust/serde_json/tests/regression/issue520.rs b/third_party/rust/serde_json/tests/regression/issue520.rs index 9ed367731b..730ecc60a8 100644 --- a/third_party/rust/serde_json/tests/regression/issue520.rs +++ b/third_party/rust/serde_json/tests/regression/issue520.rs @@ -1,6 +1,6 @@ #![allow(clippy::float_cmp)] -use serde_derive::{Serialize, Deserialize}; +use serde_derive::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "type", content = "data")] diff --git a/third_party/rust/serde_json/tests/regression/issue795.rs b/third_party/rust/serde_json/tests/regression/issue795.rs index bb82852c54..411e8af5d3 100644 --- a/third_party/rust/serde_json/tests/regression/issue795.rs +++ b/third_party/rust/serde_json/tests/regression/issue795.rs @@ -8,7 +8,10 @@ use std::fmt; #[derive(Debug)] pub enum Enum { - Variant { x: u8 }, + Variant { + #[allow(dead_code)] + x: u8, + }, } impl<'de> Deserialize<'de> for Enum { diff --git a/third_party/rust/serde_json/tests/regression/issue845.rs b/third_party/rust/serde_json/tests/regression/issue845.rs index 56037ae669..7b6564dadb 100644 --- a/third_party/rust/serde_json/tests/regression/issue845.rs +++ b/third_party/rust/serde_json/tests/regression/issue845.rs @@ -1,7 +1,6 @@ #![allow(clippy::trait_duplication_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/8757 use serde::{Deserialize, Deserializer}; -use std::convert::TryFrom; use std::fmt::{self, Display}; use std::marker::PhantomData; use std::str::FromStr; @@ -61,6 +60,7 @@ where #[derive(Deserialize, Debug)] pub struct Struct { #[serde(deserialize_with = "deserialize_integer_or_string")] + #[allow(dead_code)] pub i: i64, } |