Add test for {:#?} format of Value

This commit is contained in:
David Tolnay
2020-05-09 16:27:55 -07:00
parent 800a8d58a9
commit baae6d9306

View File

@@ -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);
}