Skip to content
Myr

Add test of drop after downcast

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 00911a3 · Browse files · 1 file+14 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+14 added−0 removed

  • tests:+14 added−0 removed

1 file+14 added−0 removed

modified:tests/test_downcast.rs+14 added
1mod common;2mod drop;34use self::common::*;5use self::drop::DetectDrop;6use anyhow::Error;7use std::io;8use std::sync::atomic::AtomicBool;9use std::sync::atomic::Ordering::SeqCst;10use std::sync::Arc;1112#[test]13fn test_downcast() {14 assert_eq!(
52 unmodified lines
67 .unwrap()68 .to_string(),69 );70}7172#[test]73fn test_drop() {74 let has_dropped = Arc::new(AtomicBool::new(false));75 let error = Error::new(DetectDrop::new(&has_dropped));76 drop(error.downcast::<DetectDrop>().unwrap());77 assert!(has_dropped.load(SeqCst));78}