Crate test_tag

source ·
Expand description

Tagging functionality for tests, allowing for convenient grouping and later execution of certain groups.

For example, a test can be associated with the tag miri, to indicate that it is suitable for being run under Miri:

use test_tag::tag;

#[tag(miri)]
#[test]
fn test1() {
  assert_eq!(2 + 2, 4);
}

Subsequently, it is possible to run only those tests under Miri:

$ cargo miri test -- :miri:

Please note that the usage of Miri is just an example (if the majority of tests is Miri-compatible you can use #[cfg_attr(miri, ignore)] instead and may not require a custom attribute). However, tagging can be useful for other properties, such as certain tests requiring alleviated rights (need to be run with administrator privileges).

This crate provides the #[test_tag::tag] attribute that allows for such tagging to happen.

Attribute Macros§

  • A procedural macro for the tag attribute.