Skip to content
Myr

Add test of unsuccessful downcasts

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 4ec3791 · Browse files · 1 file+8 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−0 removed

  • tests:+8 added−0 removed

1 file+8 added−0 removed

modified:tests/test_downcast.rs+8 added
97 unmodified lines
98 "oh no!",99 error.downcast_ref::<LargeAlignedError>().unwrap().0100 );101}102103#[test]104fn test_unsuccessful_downcast() {105 let mut error = bail_error().unwrap_err();106 assert!(error.downcast_ref::<&str>().is_none());107 assert!(error.downcast_mut::<&str>().is_none());108 assert!(error.downcast::<&str>().is_err());109}