tests: improve test output consistency

`expected` and `command` are more helpful than `new` and `old`.
the order of `expected` and `command` should now always be the same:
expected before command

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
This commit is contained in:
Mira Limbeck 2024-02-20 11:06:45 +01:00 committed by Stoiko Ivanov
parent 8a5b28ff16
commit a36803db4a

View File

@ -26,21 +26,21 @@ pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
expected_lines.len(), expected_lines.len(),
command_lines.len() command_lines.len()
); );
for (old, new) in expected_lines.iter().zip(command_lines.iter()) { for (expected, command) in expected_lines.iter().zip(command_lines.iter()) {
if new.starts_with("# ") && old.starts_with("# ") { if command.starts_with("# ") && expected.starts_with("# ") {
continue; continue;
} else if new.starts_with("# ") { } else if command.starts_with("# ") {
assert!( assert!(
false, false,
"comment line found in command output, but not in expected output" "comment line found in command output, but not in expected output"
); );
} else if old.starts_with("# ") { } else if expected.starts_with("# ") {
assert!( assert!(
false, false,
"comment line found in expected output, but not in command output" "comment line found in expected output, but not in command output"
); );
} }
assert_eq!(new, old); assert_eq!(expected, command);
} }
} }