use super::{dump, enabled, wants};
#[test]
fn a_build_without_the_feature_reports_nothing_and_says_so() {
if cfg!(feature = "trace") {
return;
}
assert!(!enabled(), "tracing cannot be on without the feature");
assert!(
!wants("anything"),
"no target is traced without the feature"
);
assert!(
dump().contains("without the `trace` feature"),
"a dump must say why it is empty rather than look like a clean run -- an empty trace and \
a trace that was never compiled in are very different findings"
);
}
#[test]
fn recording_is_inert_without_the_feature() {
if cfg!(feature = "trace") {
return;
}
crate::trace_record!("test", "inert", 1, 2);
assert!(!dump().contains("inert"));
}
#[test]
fn the_filter_narrows_to_the_targets_named() {
if !cfg!(feature = "trace") {
return;
}
for target in ["wait", "delivery", "something-else"] {
if wants(target) {
assert!(
enabled(),
"a wanted target implies the trace is enabled: {target}"
);
}
}
}