()
| 32 | |
| 33 | #[test] |
| 34 | fn ensure() { |
| 35 | capture_ok(|| { |
| 36 | ensure!(true, RootError); |
| 37 | Ok(()) |
| 38 | }); |
| 39 | let report = capture_error(|| { |
| 40 | ensure!(false, RootError); |
| 41 | Ok(()) |
| 42 | }) |
| 43 | .attach(PrintableA(0)); |
| 44 | assert!(report.contains::<RootError>()); |
| 45 | assert!(report.contains::<PrintableA>()); |
| 46 | assert!(!report.contains::<PrintableB>()); |
| 47 | assert_eq!(report.current_context(), &RootError); |
| 48 | assert_eq!(report.frames().count(), expect_count(2)); |
| 49 | assert_eq!( |
| 50 | remove_builtin_messages(messages(&report)), |
| 51 | remove_builtin_messages(["printable A", "root error"]) |
| 52 | ); |
| 53 | |
| 54 | let report = capture_error(|| { |
| 55 | ensure!(false, report); |
| 56 | Ok(()) |
| 57 | }) |
| 58 | .attach(PrintableB(0)); |
| 59 | assert!(report.contains::<RootError>()); |
| 60 | assert!(report.contains::<PrintableA>()); |
| 61 | assert!(report.contains::<PrintableB>()); |
| 62 | assert_eq!(report.current_context(), &RootError); |
| 63 | assert_eq!(report.frames().count(), expect_count(3)); |
| 64 | assert_eq!( |
| 65 | remove_builtin_messages(messages(&report)), |
| 66 | remove_builtin_messages(["printable B", "printable A", "root error"]) |
| 67 | ); |
| 68 | } |
nothing calls this directly
no test coverage detected