Skip to content

Commit

Permalink
Merge pull request rustwasm#116 from userzimmermann/zimmermann/windows
Browse files Browse the repository at this point in the history
test: Compare expected w/actual outputs line-wise
  • Loading branch information
fitzgen authored Aug 13, 2018
2 parents cdbee30 + d24e526 commit 7e86fc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions twiggy/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ macro_rules! test {
let expected = slurp(expected_path).unwrap_or(vec![]);
let expected = String::from_utf8_lossy(&expected);
let expected = expected.trim();
let expected_lines = expected.lines().collect::<Vec<&str>>();

let actual = String::from_utf8_lossy(&output.stdout);
let actual = actual.trim();
let actual_lines = actual.lines().collect::<Vec<&str>>();

if actual != expected {
if actual_lines != expected_lines {
let mut cmd = "twiggy".to_string();
$(
cmd.push(' ');
Expand All @@ -61,7 +63,7 @@ macro_rules! test {

println!("--- {}", expected_path);
println!("+++ actually generated by `{}`", cmd);
for diff in diff::lines(&expected, &actual) {
for diff in diff::slice(&expected_lines, &actual_lines) {
match diff {
diff::Result::Left(l) => println!("-{}", l),
diff::Result::Both(l, _) => println!(" {}", l),
Expand Down

0 comments on commit 7e86fc5

Please sign in to comment.