Fix tests.

This commit is contained in:
Stephen Chung 2020-09-14 11:40:23 +08:00 committed by J Henry Waugh
parent 52298bd96c
commit c63f30a6a2
3 changed files with 424 additions and 101 deletions

View File

@ -237,11 +237,14 @@ mod generate_tests {
let expected = expected.to_string(); let expected = expected.to_string();
if &actual != &expected { if &actual != &expected {
let mut counter = 0; let mut counter = 0;
let iter = actual let iter = actual.chars().zip(expected.chars()).skip_while(|(a, e)| {
.chars() if *a == *e {
.zip(expected.chars()) counter += 1;
.inspect(|_| counter += 1) true
.skip_while(|(a, e)| *a == *e); } else {
false
}
});
let (actual_diff, expected_diff) = { let (actual_diff, expected_diff) = {
let mut actual_diff = String::new(); let mut actual_diff = String::new();
let mut expected_diff = String::new(); let mut expected_diff = String::new();
@ -252,8 +255,10 @@ mod generate_tests {
(actual_diff, expected_diff) (actual_diff, expected_diff)
}; };
eprintln!("actual != expected, diverge at char {}", counter); eprintln!("actual != expected, diverge at char {}", counter);
eprintln!(" actual: {}", actual_diff);
eprintln!("expected: {}", expected_diff);
assert!(false);
} }
assert_eq!(actual, expected);
} }
#[test] #[test]

File diff suppressed because it is too large Load Diff

0
xxx.rs
View File