#[skuld::test]
fn levels_since_reports_each_matching_records_level() {
super::install();
let mark = super::mark();
log::debug!("log_capture level-probe 91c7");
log::warn!("log_capture level-probe 91c7");
log::warn!("log_capture unrelated-probe 91c7");
assert_eq!(
super::levels_since(mark, "log_capture level-probe 91c7"),
vec![log::Level::Debug, log::Level::Warn],
"levels come back in emission order, and only for matching records"
);
}
#[skuld::test]
fn pre_mark_records_never_satisfy_a_post_mark_scan() {
super::install();
log::warn!("log_capture stale-probe 5f21");
let mark = super::mark();
assert!(
!super::contains_since(mark, "log_capture stale-probe 5f21"),
"a record emitted before the mark must be invisible to contains_since"
);
log::warn!("log_capture fresh-probe 5f21");
assert!(
super::contains_since(mark, "log_capture fresh-probe 5f21"),
"a record emitted after the mark must be found"
);
}
#[skuld::test]
fn current_thread_scan_ignores_identical_records_from_other_threads() {
super::install();
let mark = super::mark();
std::thread::spawn(|| log::warn!("log_capture thread-probe 3ad9"))
.join()
.expect("other thread");
log::warn!("log_capture thread-probe 3ad9");
assert_eq!(
super::records_since_on_current_thread(mark, "log_capture thread-probe 3ad9").len(),
1,
"only this thread's record counts"
);
assert_eq!(
super::records_since(mark, "log_capture thread-probe 3ad9").len(),
2,
"the unfiltered scan still sees both"
);
}