v0.1.3-pre.006
This commit is contained in:
20
crates/ksp-logging-lib/unit_tests/domain.rs
Normal file
20
crates/ksp-logging-lib/unit_tests/domain.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
// file: crates/ksp-logging-lib/unit_tests/domain.rs
|
||||
// version: 1
|
||||
|
||||
#[test]
|
||||
fn wildcard_domain_matches_with_or_without_current_domain() {
|
||||
super::set_current_domain(std::option::Option::None);
|
||||
assert!(super::current_domain_matches(&["*".to_string()]));
|
||||
super::set_current_domain(std::option::Option::Some("logging"));
|
||||
assert!(super::current_domain_matches(&["*".to_string()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn named_domain_requires_current_matching_prefix() {
|
||||
super::set_current_domain(std::option::Option::None);
|
||||
assert!(!super::current_domain_matches(&["logging".to_string()]));
|
||||
super::set_current_domain(std::option::Option::Some("logging.runtime"));
|
||||
assert!(super::current_domain_matches(&["logging".to_string()]));
|
||||
assert!(super::current_domain_matches(&["store".to_string(), "logging.runtime".to_string()]));
|
||||
assert!(!super::current_domain_matches(&["store".to_string()]));
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-logging-lib/unit_tests/runtime.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
#[test]
|
||||
fn level_mapping_covers_all_ksp_levels() {
|
||||
@@ -154,7 +154,7 @@ fn multi_sink_runtime_accepts_metadata_routing_formats_and_console_ansi() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn domain_routing_is_explicitly_deferred_instead_of_ignored() {
|
||||
fn domain_routing_is_accepted_by_runtime_preparation() {
|
||||
let console = crate::ConsoleSettings::new(
|
||||
true,
|
||||
crate::ConsoleOutput::Stdout,
|
||||
@@ -165,12 +165,7 @@ fn domain_routing_is_explicitly_deferred_instead_of_ignored() {
|
||||
let settings = crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::Some(console), std::vec::Vec::new());
|
||||
assert!(settings.validate().is_ok());
|
||||
let result = super::prepare_runtime(&settings);
|
||||
assert!(result.is_err());
|
||||
let error = match result {
|
||||
std::result::Result::Ok(_) => return,
|
||||
std::result::Result::Err(error) => error,
|
||||
};
|
||||
assert_eq!(error.code(), crate::ERROR_CODE_INVALID_SETTINGS);
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
struct BlockingWriter {
|
||||
|
||||
Reference in New Issue
Block a user