BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.32k stars 144 forks source link

Tests fail for target wasm32-wasi #273

Open Spoonbender opened 3 years ago

Spoonbender commented 3 years ago

Running cargo build --target wasm32-wasi succeeds, but cargo wasi test fails:

Spoonbender commented 3 years ago

Just to elaborate on the 2nd case: According to Testing in WASI, "The wasm32-wasi target for Rust is effectively a panic=abort target which has no support for unwinding". This means that the AssertUnwindSafe function used in tester.rs can't actually perform its duty for this target (or any other panic=abort target). Additionally, when running cargo wasi test, all tests decorated #[should_panic] are ignored.

This means we need to decide how we'd like quickcheck to behave in case of wasi or any other target that doesn't support unwinding. The std::panic::set_hook function might be helpful here, as it allows setting a hook that runs on both unwinding and aborting targets.

Adding support for aborting targets, however, could be considered a completely new feature for quicktest - and for the time being we might just ensure tests pass for wasi w/o adding this support.