Attribute Macro fork

Source
#[fork]
Expand description

A procedural macro for running a test or benchmark in a separate process.

This attribute is able to cater to both tests and benchmarks, while #[test] is specific to tests and #[bench] to benchmarks.

Contrary to both, this attribute does not in itself make a function a test/benchmark, so it will always have to be combined with an additional “inner” attribute. However, it can be more convenient for annotating only a sub-set of tests/benchmarks for running in separate processes, especially when non-standard attributes are involved:

§Example

use test_fork::fork;

#[fork]
#[test]
fn test3() {
  assert_eq!(2 + 4, 6);
}

#[fork]
#[bench]
fn bench3(b: &mut Bencher) {
  b.iter(|| sleep(Duration::from_millis(1)));
}