Skip to content

Commit

Permalink
Move expected value for indented debug test into test
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 21, 2022
1 parent 39fa675 commit a047355
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ryu = "1.0"

[dev-dependencies]
automod = "1.0"
indoc = "1.0"
ref-cast = "1.0"
rustversion = "1.0"
serde = { version = "1.0.100", features = ["derive"] }
Expand Down
26 changes: 14 additions & 12 deletions tests/debug.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use indoc::indoc;
use serde_json::{json, Number, Value};

#[test]
Expand Down Expand Up @@ -50,19 +51,20 @@ 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 expected = indoc! {r#"
Object({
"array": Array([
Number(
0,
),
Number(
1,
),
]),
})"#
};
assert_eq!(format!("{:#?}", j), expected);
}

0 comments on commit a047355

Please sign in to comment.