get drop working

This commit is contained in:
nora 2022-04-03 13:25:41 +02:00
parent 74bd6e064f
commit a453f210b3
2 changed files with 38 additions and 12 deletions

View file

@ -130,7 +130,7 @@ fn map_ptr<T>(ptr: *mut T, map: impl FnOnce(usize) -> usize) -> *mut T {
#[cfg(test)]
mod tests {
use crate::strategies::test_strategies::HasDebug;
use crate::strategies::test_strategies::{HasDebug, PanicsInDrop};
use crate::StuffedPtr;
#[test]
@ -160,4 +160,13 @@ mod tests {
"StuffedPtr::Extra { extra: hello! }"
);
}
#[test]
#[should_panic]
fn needs_drop() {
let extra = PanicsInDrop;
let stuffed_ptr: StuffedPtr<(), PanicsInDrop> = StuffedPtr::new_extra(extra);
// the panicking drop needs to be called here!
drop(stuffed_ptr);
}
}