#panic #test

hushed_panic

Hush panic!s for a single thread

1 unstable release

0.1.1 Aug 17, 2021
0.1.0 Aug 9, 2021

#658 in Testing

MIT/Apache

7KB

hushed_panic

A crate for hushing panics for a specific thread.

This is especially useful for when you want to hush tests which are intended to panic, but do not want to see the long output.

Usage in a test:

fn my_test() {
    let _x = hushed_panic::hush_this_test();
    panic!(); // Won't print anything!
    drop(_x);
    panic!(); // Would print normally!
}

License

hushed_panic is distributed under the terms of either the MIT license, or the Apache License (Version 2.0) at the user's choice.

See the files named LICENSE-MIT and LICENSE-APACHE2 relative to the root directory of this project for more details.


lib.rs:

A crate for hushing panics for a specific thread.

This is especially useful for when you want to hush tests which are intended to panic, but do not want to see the long output.

Usage in a test:

fn my_test() {
    let _x = hushed_panic::hush_this_test();
    panic!(); // Won't print anything!
    drop(_x);
    panic!(); // Would print normally!
}

Dependencies

~0.5–0.8MB
~13K SLoC