mirror of
https://github.com/Noratrieb/stuff.git
synced 2026-01-14 16:35:08 +01:00
get drop working
This commit is contained in:
parent
74bd6e064f
commit
a453f210b3
2 changed files with 38 additions and 12 deletions
11
src/lib.rs
11
src/lib.rs
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue