bitwizeshift / bitwizeshift/oxtest

Support `should_panic` in main tests

Open
#15 0 comments 0 reactions 1 assignee Claimed by @bitwizeshift View on GitHub
🪲 Bug
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Adding support for returning `TestResult` objects in #6 introduced an unexpected bug: the `#[should_panic]` attribute no longer functions correctly. `#[should_panic]` apparently only works in functions returning `()`, which raises questions as to the future direction of testing in this library:

1. Should an assertion library be made that returns `Error` objects as #7 suggests? Doing this would mean that `#[should_panic]` tests cannot actually work with these assertions

2. A custom `assert_panic!(...)` macro can be added that is implemented in terms of `std::panic::handle_unwind` -- however this is documented to only work for panics that perform unwinding. It's unclear if this is also the behavior of `#[should_panic]`, or whether `#[should_panic]` can actually catch cases that abort.

A decision needs to be made in order to progress here. It's possible that supporting attributes in subtests in #14 might be sufficient for handling this, in that subtests can return `()` whereas other tests return `Error`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.