use sqry_core::test_support::verbosity;
use std::sync::Once;
static INIT: Once = Once::new();
fn init_logging() {
INIT.call_once(|| {
verbosity::init(env!("CARGO_PKG_NAME"));
});
}
#[test]
fn test_verbose_logging_works() {
init_logging();
log::info!("This is an info message");
log::debug!("This is a debug message");
log::trace!("This is a trace message");
}
#[test]
fn test_multiple_init_calls_safe() {
init_logging();
init_logging(); log::info!("Multiple init calls are safe");
}
#[test]
fn test_logging_in_threads() {
init_logging();
let handles: Vec<_> = (0..4)
.map(|i| {
std::thread::spawn(move || {
log::info!("Thread {i} message");
})
})
.collect();
for handle in handles {
handle.join().unwrap();
}
}
#[test]
fn test_should_enable_parsing() {
assert!(verbosity::should_enable("sqry-core") || !verbosity::should_enable("sqry-core"));
}