Skip to content

Commit

Permalink
Add test for {:#?} format of Value
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 9, 2020
1 parent 800a8d5 commit baae6d9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/debug.rs
Expand Up @@ -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);
}

0 comments on commit baae6d9

Please sign in to comment.