Skip to content

Commit 94ce9c1

Browse files
authored
Merge pull request #89 from eddyb/fix-trailing-comma
tests: ignore trailing commas in {:#?} output.
2 parents 44ffe0d + 7aa39f3 commit 94ce9c1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

macros/tests/basic.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ macro_rules! testcases {
1212
fn $name() {
1313
$name::$rule::parse_with($input, |parser, result| {
1414
let result = format!("{:#?}", result.unwrap());
15+
// FIXME(eddyb) Remove this trailing-comma-ignoring hack
16+
// once rust-lang/rust#59076 reaches the stable channel.
17+
let normalize = |s: &str| {
18+
s.replace(",\n", "\n")
19+
};
1520
assert!(
16-
result == $expected,
21+
normalize(&result) == normalize($expected),
1722
"mismatched output, expected:\n{}\n\nfound:\n{}",
1823
$expected,
1924
result

macros/tests/json.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,13 @@ Value::Object {
111111
}
112112
]
113113
}";
114+
// FIXME(eddyb) Remove this trailing-comma-ignoring hack
115+
// once rust-lang/rust#59076 reaches the stable channel.
116+
let normalize = |s: &str| {
117+
s.replace(",\n", "\n")
118+
};
114119
assert!(
115-
result == expected,
120+
normalize(&result) == normalize(expected),
116121
"mismatched output, expected:\n{}\n\nfound:\n{}",
117122
expected,
118123
result

0 commit comments

Comments
 (0)