camshaft / bolero

property testing and verification front-end for Rust
https://camshaft.github.io/bolero
MIT License
185 stars 17 forks source link

allow bolero tests to run on wasm32-unknown-unknown #204

Open Ekleog opened 9 months ago

Ekleog commented 9 months ago

This PR allows crate developers to run bolero::check!() tests on wasm32-unknown-unknown.

This is not fuzzing yet, but at least basic proptesting works there, with this PR :)

Considering the infrastructure required for testing (all the wasm-bindgen stuff), I'm not submitting a new test here; but I checked on the repo with my use case that a test that takes an u8 and matches for != 4 did fail as expected.

Basing the test on target_os should also (hopefully) make bolero work for embedded development proptesting.

Ekleog commented 9 months ago

Disclaimer: I ended up not being able to actually use cargo-bolero, because there's no async executor that works well on the web except the browser's, and for_each is not async-ready.

I looked into making for_each async, but it looked like an intricate mess of types, so I gave up.

I still think this can be useful for people who want to test sync code, but for my use case it's actually unfortunately not enough.

camshaft commented 8 months ago

I like the idea of supporting wasm. But I think we'll need tests in place so we don't accidentally regress before merging something like this.