From a990de90fe41456a23e58bd087d2f107d321f3a1 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 19 Jul 2024 16:37:58 +0400 Subject: Deleted vendor folder --- vendor/serde_json/tests/regression/issue1004.rs | 12 ---- vendor/serde_json/tests/regression/issue520.rs | 20 ------- vendor/serde_json/tests/regression/issue795.rs | 59 -------------------- vendor/serde_json/tests/regression/issue845.rs | 73 ------------------------- vendor/serde_json/tests/regression/issue953.rs | 9 --- 5 files changed, 173 deletions(-) delete mode 100644 vendor/serde_json/tests/regression/issue1004.rs delete mode 100644 vendor/serde_json/tests/regression/issue520.rs delete mode 100644 vendor/serde_json/tests/regression/issue795.rs delete mode 100644 vendor/serde_json/tests/regression/issue845.rs delete mode 100644 vendor/serde_json/tests/regression/issue953.rs (limited to 'vendor/serde_json/tests/regression') diff --git a/vendor/serde_json/tests/regression/issue1004.rs b/vendor/serde_json/tests/regression/issue1004.rs deleted file mode 100644 index c09fb96..0000000 --- a/vendor/serde_json/tests/regression/issue1004.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![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/vendor/serde_json/tests/regression/issue520.rs b/vendor/serde_json/tests/regression/issue520.rs deleted file mode 100644 index 9ed3677..0000000 --- a/vendor/serde_json/tests/regression/issue520.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![allow(clippy::float_cmp)] - -use serde_derive::{Serialize, Deserialize}; - -#[derive(Serialize, Deserialize, Debug)] -#[serde(tag = "type", content = "data")] -enum E { - Float(f32), -} - -#[test] -fn test() { - let e = E::Float(159.1); - let v = serde_json::to_value(e).unwrap(); - let e = serde_json::from_value::(v).unwrap(); - - match e { - E::Float(f) => assert_eq!(f, 159.1), - } -} diff --git a/vendor/serde_json/tests/regression/issue795.rs b/vendor/serde_json/tests/regression/issue795.rs deleted file mode 100644 index bb82852..0000000 --- a/vendor/serde_json/tests/regression/issue795.rs +++ /dev/null @@ -1,59 +0,0 @@ -#![allow(clippy::assertions_on_result_states)] - -use serde::de::{ - Deserialize, Deserializer, EnumAccess, IgnoredAny, MapAccess, VariantAccess, Visitor, -}; -use serde_json::json; -use std::fmt; - -#[derive(Debug)] -pub enum Enum { - Variant { x: u8 }, -} - -impl<'de> Deserialize<'de> for Enum { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct EnumVisitor; - - impl<'de> Visitor<'de> for EnumVisitor { - type Value = Enum; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("enum Enum") - } - - fn visit_enum(self, data: A) -> Result - where - A: EnumAccess<'de>, - { - let (IgnoredAny, variant) = data.variant()?; - variant.struct_variant(&["x"], self) - } - - fn visit_map(self, mut data: A) -> Result - where - A: MapAccess<'de>, - { - let mut x = 0; - if let Some((IgnoredAny, value)) = data.next_entry()? { - x = value; - } - Ok(Enum::Variant { x }) - } - } - - deserializer.deserialize_enum("Enum", &["Variant"], EnumVisitor) - } -} - -#[test] -fn test() { - let s = r#" {"Variant":{"x":0,"y":0}} "#; - assert!(serde_json::from_str::(s).is_err()); - - let j = json!({"Variant":{"x":0,"y":0}}); - assert!(serde_json::from_value::(j).is_err()); -} diff --git a/vendor/serde_json/tests/regression/issue845.rs b/vendor/serde_json/tests/regression/issue845.rs deleted file mode 100644 index e8b0c0f..0000000 --- a/vendor/serde_json/tests/regression/issue845.rs +++ /dev/null @@ -1,73 +0,0 @@ -#![allow(clippy::trait_duplication_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/8757 - -use serde::{Deserialize, Deserializer}; -use std::fmt::{self, Display}; -use std::marker::PhantomData; -use std::str::FromStr; - -pub struct NumberVisitor { - marker: PhantomData, -} - -impl<'de, T> serde::de::Visitor<'de> for NumberVisitor -where - T: TryFrom + TryFrom + FromStr, - >::Error: Display, - >::Error: Display, - ::Err: Display, -{ - type Value = T; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("an integer or string") - } - - fn visit_u64(self, v: u64) -> Result - where - E: serde::de::Error, - { - T::try_from(v).map_err(serde::de::Error::custom) - } - - fn visit_i64(self, v: i64) -> Result - where - E: serde::de::Error, - { - T::try_from(v).map_err(serde::de::Error::custom) - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - v.parse().map_err(serde::de::Error::custom) - } -} - -fn deserialize_integer_or_string<'de, D, T>(deserializer: D) -> Result -where - D: Deserializer<'de>, - T: TryFrom + TryFrom + FromStr, - >::Error: Display, - >::Error: Display, - ::Err: Display, -{ - deserializer.deserialize_any(NumberVisitor { - marker: PhantomData, - }) -} - -#[derive(Deserialize, Debug)] -pub struct Struct { - #[serde(deserialize_with = "deserialize_integer_or_string")] - pub i: i64, -} - -#[test] -fn test() { - let j = r#" {"i":100} "#; - println!("{:?}", serde_json::from_str::(j).unwrap()); - - let j = r#" {"i":"100"} "#; - println!("{:?}", serde_json::from_str::(j).unwrap()); -} diff --git a/vendor/serde_json/tests/regression/issue953.rs b/vendor/serde_json/tests/regression/issue953.rs deleted file mode 100644 index 771aa52..0000000 --- a/vendor/serde_json/tests/regression/issue953.rs +++ /dev/null @@ -1,9 +0,0 @@ -use serde_json::Value; - -#[test] -fn test() { - let x1 = serde_json::from_str::("18446744073709551615."); - assert!(x1.is_err()); - let x2 = serde_json::from_str::("18446744073709551616."); - assert!(x2.is_err()); -} -- cgit v1.2.3