On 2024-07-23 12:46, Christoph Heiss wrote:
On Tue, Jul 23, 2024 at 12:39:20PM GMT, Aaron Lauterer wrote:
Do we still see which test case actually failed? IIRC I used the panic so I
can print the needed info, mainly the name of the current test scenario so
it is easier to find out which failed.
Yes, since it printed earlier in the code, at the start of the
`if extension == "toml" { .. }` block.
ah okay.
I quickly compared both variants and realized again, that with the
panic, we can pretty debug print the structs, making it quite a bit
easier to compare the expected result to the actual one.
With the output we get from `assert_eq` it can be very cumbersome to
actually see the diff and why the test failed since the data structures
can be quite large.
Instead of hacking or own pretty print, we could maybe think about using
https://crates.io/crates/pretty_assertions
On 2024-07-18 15:48, Christoph Heiss wrote:
Signed-off-by: Christoph Heiss <c.he...@proxmox.com>
---
Changes v1 -> v2:
* new patch, suggested by Stefan
---
proxmox-auto-installer/tests/parse-answer.rs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs
b/proxmox-auto-installer/tests/parse-answer.rs
index 450915a..1fc515e 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -75,12 +75,8 @@ fn test_parse_answers() {
path.push(format!("{name}.json"));
let compare_raw = std::fs::read_to_string(&path).unwrap();
let compare: Value = serde_json::from_str(&compare_raw).unwrap();
- if config != compare {
- panic!(
- "Test {} failed:\nleft: {:#?}\nright: {:#?}\n",
- name, config, compare
- );
- }
+
+ assert_eq!(config, compare);
}
}
}
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel