Skip to content

Commit

Permalink
Merge pull request #89 from eddyb/fix-trailing-comma
Browse files Browse the repository at this point in the history
tests: ignore trailing commas in {:#?} output.
  • Loading branch information
Centril authored Apr 6, 2019
2 parents 44ffe0d + 7aa39f3 commit 94ce9c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion macros/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ macro_rules! testcases {
fn $name() {
$name::$rule::parse_with($input, |parser, result| {
let result = format!("{:#?}", result.unwrap());
// FIXME(eddyb) Remove this trailing-comma-ignoring hack
// once rust-lang/rust#59076 reaches the stable channel.
let normalize = |s: &str| {
s.replace(",\n", "\n")
};
assert!(
result == $expected,
normalize(&result) == normalize($expected),
"mismatched output, expected:\n{}\n\nfound:\n{}",
$expected,
result
Expand Down
7 changes: 6 additions & 1 deletion macros/tests/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ Value::Object {
}
]
}";
// FIXME(eddyb) Remove this trailing-comma-ignoring hack
// once rust-lang/rust#59076 reaches the stable channel.
let normalize = |s: &str| {
s.replace(",\n", "\n")
};
assert!(
result == expected,
normalize(&result) == normalize(expected),
"mismatched output, expected:\n{}\n\nfound:\n{}",
expected,
result
Expand Down

0 comments on commit 94ce9c1

Please sign in to comment.