#drop #test

droptest

A helper crate for testing drop-semantics

4 releases

0.2.1 Oct 25, 2021
0.2.0 Oct 25, 2021
0.1.1 Oct 25, 2021
0.1.0 Oct 25, 2021

#481 in Testing

Download history 60/week @ 2024-07-19 113/week @ 2024-07-26 5/week @ 2024-08-02 81/week @ 2024-08-16 17/week @ 2024-08-23 31/week @ 2024-08-30 241/week @ 2024-09-06 60/week @ 2024-09-13 83/week @ 2024-09-20 62/week @ 2024-09-27 46/week @ 2024-10-04 28/week @ 2024-10-11 229/week @ 2024-10-18 119/week @ 2024-10-25 108/week @ 2024-11-01

489 downloads per month
Used in write-only

MPL-2.0 license

20KB
313 lines

droptest

Checks Downloads Version License

Synopsis

A Rust helper crate for testing drop-semantics.

Motivation

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!

Usage

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);

Contributing

Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.

No runtime deps