multiplatform_test

Crates.iomultiplatform_test
lib.rsmultiplatform_test
version0.5.0
created_at2023-04-24 20:38:53.933576+00
updated_at2025-03-08 01:08:36.39918+00
descriptionA simple attribute macro to combine `#[test]` and `#[wasm_bindgen_test]`
homepage
repositoryhttps://github.com/hydro-project/hydro
max_upload_size
id847891
size40,198
Shadaj Laddad (shadaj)

documentation

https://docs.rs/multiplatform_test/

README

multiplatform_test

Provides a proc-macro that expands to testing on platforms relevant to Hydroflow. By default, expands to testing on the host (using the normal #[test] attribute) and wasm (using #[wasm_bindgen_test]).

For example, the test

use multiplatform_test::multiplatform_test;

#[multiplatform_test]
fn my_test() {
  // ...
}

Expands to

#[test]
#[wasm_bindgen_test::wasm_bindgen_test]
fn my_test() {
  // ...
}

Installation

[dependencies]
multiplatform_test = * # replace with version.

If you're using wasm naturally you will need to add the wasm_bindgen_test crate as a dependency.

Usage

Specifying platforms

There are many platforms which can be specified:

You can test on a subset of platforms by passing in the platforms in parens:

use multiplatform_test::multiplatform_test;

#[multiplatform_test(test, env_logging)]  // Only test on the standard `#[test]` platform, but enables logging
fn my_test() {
  // ...
}

expands to

use multiplatform_test::multiplatform_test;

#[test]
fn my_test() {
  let _ = env_logger::builder().is_test(true).try_init();
  // ...
}
Commit count: 1798

cargo fmt