Debian Codegraph @

debian/rust-vendor/pretty_assertions/examples/standard_assertion.rs

raw
1 #[derive(Debug, PartialEq)]
2 struct Foo {
3 lorem: &'static str,
4 ipsum: u32,
5 dolor: Result<String, String>,
6 }
7
8 fn compare() {
9 let x = Some(Foo {
10 lorem: "Hello World!",
11 ipsum: 42,
12 dolor: Ok("hey".to_string()),
13 });
14 let y = Some(Foo {
15 lorem: "Hello Wrold!",
16 ipsum: 42,
17 dolor: Ok("hey ho!".to_string()),
18 });
19
20 assert_eq!(x, y);
21 }
22
23 fn main() {
24 let result = std::panic::catch_unwind(compare);
25 assert!(result.is_err(), "example did not panic");
26 }