7 releases (breaking)

Uses new Rust 2024

0.6.0 Nov 25, 2025
0.5.0 Mar 8, 2025
0.4.0 Dec 23, 2024
0.3.0 Nov 8, 2024
0.0.0 Apr 24, 2023

#2659 in Procedural macros

Download history 51/week @ 2025-10-14 29/week @ 2025-10-21 8/week @ 2025-10-28 25/week @ 2025-11-04 6/week @ 2025-11-11 12/week @ 2025-11-18 9/week @ 2025-11-25 27/week @ 2025-12-02 52/week @ 2025-12-09 194/week @ 2025-12-16 58/week @ 2025-12-23 43/week @ 2025-12-30 55/week @ 2026-01-06 75/week @ 2026-01-13 416/week @ 2026-01-20 142/week @ 2026-01-27

724 downloads per month
Used in 2 crates

Apache-2.0

13KB
201 lines

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();
  // ...
}

Dependencies

~68KB