mirror of
https://github.com/serde-rs/json.git
synced 2026-04-19 13:16:05 +00:00
Add test for {:#?} format of Value
This commit is contained in:
@@ -49,3 +49,24 @@ fn error() {
|
||||
let expected = "Error(\"key must be a string\", line: 1, column: 2)";
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user