提交 cc68afb3 编写于 作者: E Eduard-Mihai Burtescu

ui tests: diff from old (expected) to new (actual) instead of backwards.

上级 26792f06
...@@ -79,7 +79,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma ...@@ -79,7 +79,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
let mut results = Vec::new(); let mut results = Vec::new();
let mut mismatch = Mismatch::new(0); let mut mismatch = Mismatch::new(0);
for result in diff::lines(actual, expected) { for result in diff::lines(expected, actual) {
match result { match result {
diff::Result::Left(str) => { diff::Result::Left(str) => {
if lines_since_mismatch >= context_size && lines_since_mismatch > 0 { 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 ...@@ -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::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; lines_since_mismatch = 0;
} }
diff::Result::Right(str) => { diff::Result::Right(str) => {
...@@ -104,8 +105,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma ...@@ -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::Context(line.to_owned()));
} }
mismatch.lines.push(DiffLine::Expected(str.to_owned())); mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
line_number += 1;
lines_since_mismatch = 0; lines_since_mismatch = 0;
} }
diff::Result::Both(str, _) => { diff::Result::Both(str, _) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册