5 releases (breaking)

0.4.0 Dec 23, 2024
0.3.0 Nov 8, 2024
0.2.0 Aug 30, 2024
0.1.0 May 24, 2024
0.0.0 Apr 24, 2023

#2277 in Procedural macros

Download history 115/week @ 2024-09-25 95/week @ 2024-10-02 80/week @ 2024-10-09 89/week @ 2024-10-16 84/week @ 2024-10-23 82/week @ 2024-10-30 192/week @ 2024-11-06 56/week @ 2024-11-13 89/week @ 2024-11-20 93/week @ 2024-11-27 109/week @ 2024-12-04 93/week @ 2024-12-11 156/week @ 2024-12-18 87/week @ 2024-12-25 10/week @ 2025-01-01 8/week @ 2025-01-08

273 downloads per month
Used in 2 crates

Apache-2.0

13KB
203 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

~76KB