[pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency
Mira Limbeck
m.limbeck at proxmox.com
Tue Feb 20 11:06:45 CET 2024
`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 at proxmox.com>
---
this patch can be applied regardless of any of the others. it doesn't
change any functionality, but just reorders output in case of errors to
be more consistent
v3:
- unchanged
tests/utils.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/utils.rs b/tests/utils.rs
index 936efc9..f303fc3 100644
--- a/tests/utils.rs
+++ b/tests/utils.rs
@@ -26,21 +26,21 @@ pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
expected_lines.len(),
command_lines.len()
);
- for (old, new) in expected_lines.iter().zip(command_lines.iter()) {
- if new.starts_with("# ") && old.starts_with("# ") {
+ for (expected, command) in expected_lines.iter().zip(command_lines.iter()) {
+ if command.starts_with("# ") && expected.starts_with("# ") {
continue;
- } else if new.starts_with("# ") {
+ } else if command.starts_with("# ") {
assert!(
false,
"comment line found in command output, but not in expected output"
);
- } else if old.starts_with("# ") {
+ } else if expected.starts_with("# ") {
assert!(
false,
"comment line found in expected output, but not in command output"
);
}
- assert_eq!(new, old);
+ assert_eq!(expected, command);
}
}
--
2.39.2
More information about the pmg-devel
mailing list