]> git.lizzy.rs Git - rust.git/commitdiff
ui tests: diff from old (expected) to new (actual) instead of backwards.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 3 Feb 2018 00:51:16 +0000 (02:51 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 3 Feb 2018 00:51:16 +0000 (02:51 +0200)
src/tools/compiletest/src/runtest.rs

index abf62a060b83b388f77c00a8c6f3d355891ebb27..46df211cbaf65f225df1c55278e5a3b39c51c5aa 100644 (file)
@@ -79,7 +79,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
     let mut results = Vec::new();
     let mut mismatch = Mismatch::new(0);
 
-    for result in diff::lines(actual, expected) {
+    for result in diff::lines(expected, actual) {
         match result {
             diff::Result::Left(str) => {
                 if lines_since_mismatch >= context_size && lines_since_mismatch > 0 {
@@ -91,7 +91,8 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
                     mismatch.lines.push(DiffLine::Context(line.to_owned()));
                 }
 
-                mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
+                mismatch.lines.push(DiffLine::Expected(str.to_owned()));
+                line_number += 1;
                 lines_since_mismatch = 0;
             }
             diff::Result::Right(str) => {
@@ -104,8 +105,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
                     mismatch.lines.push(DiffLine::Context(line.to_owned()));
                 }
 
-                mismatch.lines.push(DiffLine::Expected(str.to_owned()));
-                line_number += 1;
+                mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
                 lines_since_mismatch = 0;
             }
             diff::Result::Both(str, _) => {