Crates.io | droptest |
lib.rs | droptest |
version | 0.2.1 |
source | src |
created_at | 2021-10-25 18:43:41.186958 |
updated_at | 2021-10-25 23:15:32.296977 |
description | A helper crate for testing drop-semantics |
homepage | |
repository | https://github.com/regexident/droptest |
max_upload_size | |
id | 471124 |
size | 39,067 |
A Rust helper crate for testing drop-semantics.
When implementing one's own smart pointers or collections in Rust one tends to end up having to resort to manual memory management using std::ptr
, including manual drop management. At which point one will want to write unit tests for making sure the implementation works as one expects it to.
This is where droptest
comes in handy!
use droptest::prelude::*;
let registry = DropRegistry::default();
let guard = registry.new_guard();
let guard_id = guard.id();
assert_no_drop!(registry, guard_id);
std::mem::drop(guard);
assert_drop!(registry, guard_id);
Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.