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

#2354 in Procedural macros

Download history 99/week @ 2024-10-22 56/week @ 2024-10-29 201/week @ 2024-11-05 76/week @ 2024-11-12 73/week @ 2024-11-19 91/week @ 2024-11-26 112/week @ 2024-12-03 101/week @ 2024-12-10 104/week @ 2024-12-17 151/week @ 2024-12-24 3/week @ 2024-12-31 14/week @ 2025-01-07 1/week @ 2025-01-14 15/week @ 2025-01-21 11/week @ 2025-01-28 29/week @ 2025-02-04

57 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

~74KB