summaryrefslogtreecommitdiffstats
path: root/vendor/pretty_assertions/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /vendor/pretty_assertions/examples
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pretty_assertions/examples')
-rw-r--r--vendor/pretty_assertions/examples/standard_assertion.rs19
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");
+}