diff options
Diffstat (limited to 'vendor/pretty_assertions/examples')
-rw-r--r-- | vendor/pretty_assertions/examples/standard_assertion.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vendor/pretty_assertions/examples/standard_assertion.rs b/vendor/pretty_assertions/examples/standard_assertion.rs index fddd512f4..0a612c82e 100644 --- a/vendor/pretty_assertions/examples/standard_assertion.rs +++ b/vendor/pretty_assertions/examples/standard_assertion.rs @@ -1,11 +1,11 @@ -fn main() { - #[derive(Debug, PartialEq)] - struct Foo { - lorem: &'static str, - ipsum: u32, - dolor: Result<String, String>, - } +#[derive(Debug, PartialEq)] +struct Foo { + lorem: &'static str, + ipsum: u32, + dolor: Result<String, String>, +} +fn compare() { let x = Some(Foo { lorem: "Hello World!", ipsum: 42, @@ -19,3 +19,8 @@ fn main() { assert_eq!(x, y); } + +fn main() { + let result = std::panic::catch_unwind(compare); + assert!(result.is_err(), "example did not panic"); +} |