From 7aa39f3cab90439503326ce462333d5e738b01fe Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sat, 6 Apr 2019 20:30:18 +0300 Subject: [PATCH] tests: ignore trailing commas in {:#?} output. --- macros/tests/basic.rs | 7 ++++++- macros/tests/json.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/macros/tests/basic.rs b/macros/tests/basic.rs index 866cec0..1695d3f 100644 --- a/macros/tests/basic.rs +++ b/macros/tests/basic.rs @@ -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 diff --git a/macros/tests/json.rs b/macros/tests/json.rs index ce6eda6..67d484f 100644 --- a/macros/tests/json.rs +++ b/macros/tests/json.rs @@ -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