Attribute Macro test_env_log::test [−][src]
#[test]
👎 Deprecated since 0.2.8:
test-env-log has been renamed to test-log; use it instead
Expand description
A procedural macro for the test
attribute.
The attribute can be used to define a test that has the env_logger
and/or tracing
crates initialized (depending on the features used).
Example
Specify the attribute on a per-test basis:
#[test_env_log::test]
fn it_works() {
info!("Checking whether it still works...");
assert_eq!(2 + 2, 4);
info!("Looks good!");
}
It can be very convenient to convert over all tests by overriding
the #[test]
attribute on a per-module basis:
use test_env_log::test;
#[test]
fn it_still_works() {
// ...
}
You can also wrap another attribute. For example, suppose you use
#[tokio::test]
to run async tests:
use test_env_log::test;
#[test(tokio::test)]
async fn it_still_works() {
// ...
}