6 releases (breaking)

Uses new Rust 2024

new 0.5.0 Mar 8, 2025
0.4.0 Dec 23, 2024
0.3.0 Nov 8, 2024
0.2.0 Aug 30, 2024
0.0.0 Apr 24, 2023

#2440 in Procedural macros

Download history 59/week @ 2024-11-18 138/week @ 2024-11-25 94/week @ 2024-12-02 115/week @ 2024-12-09 47/week @ 2024-12-16 215/week @ 2024-12-23 1/week @ 2024-12-30 16/week @ 2025-01-06 2/week @ 2025-01-13 11/week @ 2025-01-20 15/week @ 2025-01-27 25/week @ 2025-02-03 12/week @ 2025-02-10 21/week @ 2025-02-17 22/week @ 2025-02-24 120/week @ 2025-03-03

175 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

~73KB