diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
commit | 2ff14448863ac1a1dd9533461708e29aae170c2d (patch) | |
tree | 85b9fea2bbfe3f06473cfa381eed11f273b57c5c /vendor/serde_json/tests | |
parent | Adding debian version 1.64.0+dfsg1-1. (diff) | |
download | rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip |
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/serde_json/tests')
-rw-r--r-- | vendor/serde_json/tests/debug.rs | 43 | ||||
-rw-r--r-- | vendor/serde_json/tests/regression/issue795.rs | 2 | ||||
-rw-r--r-- | vendor/serde_json/tests/stream.rs | 1 | ||||
-rw-r--r-- | vendor/serde_json/tests/test.rs | 1 | ||||
-rw-r--r-- | vendor/serde_json/tests/ui/missing_colon.stderr | 2 | ||||
-rw-r--r-- | vendor/serde_json/tests/ui/missing_value.stderr | 2 |
6 files changed, 34 insertions, 17 deletions
diff --git a/vendor/serde_json/tests/debug.rs b/vendor/serde_json/tests/debug.rs index d2d8448be..8ddcf5a38 100644 --- a/vendor/serde_json/tests/debug.rs +++ b/vendor/serde_json/tests/debug.rs @@ -1,3 +1,4 @@ +use indoc::indoc; use serde_json::{json, Number, Value}; #[test] @@ -26,6 +27,8 @@ fn value_number() { assert_eq!(format!("{:?}", json!(1)), "Number(1)"); assert_eq!(format!("{:?}", json!(-1)), "Number(-1)"); assert_eq!(format!("{:?}", json!(1.0)), "Number(1.0)"); + assert_eq!(Number::from_f64(1.0).unwrap().to_string(), "1.0"); // not just "1" + assert_eq!(Number::from_f64(12e40).unwrap().to_string(), "1.2e41"); } #[test] @@ -35,12 +38,12 @@ fn value_string() { #[test] fn value_array() { - assert_eq!(format!("{:?}", json!([])), "Array([])"); + assert_eq!(format!("{:?}", json!([])), "Array []"); } #[test] fn value_object() { - assert_eq!(format!("{:?}", json!({})), "Object({})"); + assert_eq!(format!("{:?}", json!({})), "Object {}"); } #[test] @@ -50,19 +53,29 @@ fn error() { assert_eq!(format!("{:?}", err), expected); } -const INDENTED_EXPECTED: &str = r#"Object({ - "array": Array([ - Number( - 0, - ), - Number( - 1, - ), - ]), -})"#; - #[test] fn indented() { - let j = json!({ "array": [0, 1] }); - assert_eq!(format!("{:#?}", j), INDENTED_EXPECTED); + let j = json!({ + "Array": [true], + "Bool": true, + "EmptyArray": [], + "EmptyObject": {}, + "Null": null, + "Number": 1, + "String": "...", + }); + let expected = indoc! {r#" + Object { + "Array": Array [ + Bool(true), + ], + "Bool": Bool(true), + "EmptyArray": Array [], + "EmptyObject": Object {}, + "Null": Null, + "Number": Number(1), + "String": String("..."), + }"# + }; + assert_eq!(format!("{:#?}", j), expected); } diff --git a/vendor/serde_json/tests/regression/issue795.rs b/vendor/serde_json/tests/regression/issue795.rs index 06b68724e..bb82852c5 100644 --- a/vendor/serde_json/tests/regression/issue795.rs +++ b/vendor/serde_json/tests/regression/issue795.rs @@ -1,3 +1,5 @@ +#![allow(clippy::assertions_on_result_states)] + use serde::de::{ Deserialize, Deserializer, EnumAccess, IgnoredAny, MapAccess, VariantAccess, Visitor, }; diff --git a/vendor/serde_json/tests/stream.rs b/vendor/serde_json/tests/stream.rs index ca54e9a15..ec6b9e3d0 100644 --- a/vendor/serde_json/tests/stream.rs +++ b/vendor/serde_json/tests/stream.rs @@ -1,4 +1,5 @@ #![cfg(not(feature = "preserve_order"))] +#![allow(clippy::assertions_on_result_states)] use serde_json::{json, Deserializer, Value}; diff --git a/vendor/serde_json/tests/test.rs b/vendor/serde_json/tests/test.rs index 13d30c490..0aeaff88d 100644 --- a/vendor/serde_json/tests/test.rs +++ b/vendor/serde_json/tests/test.rs @@ -1,5 +1,6 @@ #![cfg(not(feature = "preserve_order"))] #![allow( + clippy::assertions_on_result_states, clippy::cast_precision_loss, clippy::derive_partial_eq_without_eq, clippy::excessive_precision, diff --git a/vendor/serde_json/tests/ui/missing_colon.stderr b/vendor/serde_json/tests/ui/missing_colon.stderr index 9b83c1777..3cebc4fd3 100644 --- a/vendor/serde_json/tests/ui/missing_colon.stderr +++ b/vendor/serde_json/tests/ui/missing_colon.stderr @@ -4,4 +4,4 @@ error: unexpected end of macro invocation 4 | json!({ "a" }); | ^^^^^^^^^^^^^^ missing tokens in macro arguments | - = note: this error originates in the macro `json_internal` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `json_internal` which comes from the expansion of the macro `json` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/vendor/serde_json/tests/ui/missing_value.stderr b/vendor/serde_json/tests/ui/missing_value.stderr index d538d9613..a1edbc37b 100644 --- a/vendor/serde_json/tests/ui/missing_value.stderr +++ b/vendor/serde_json/tests/ui/missing_value.stderr @@ -4,4 +4,4 @@ error: unexpected end of macro invocation 4 | json!({ "a" : }); | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments | - = note: this error originates in the macro `json_internal` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `json_internal` which comes from the expansion of the macro `json` (in Nightly builds, run with -Z macro-backtrace for more info) |