v0.1.3-pre.005
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-logging-lib/unit_tests/settings.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
fn unrestricted_file(output_id: &str) -> crate::FileSettings {
|
||||
return crate::FileSettings::new(
|
||||
@@ -50,8 +50,10 @@ fn output_filter_preserves_level_targets_and_domains() {
|
||||
assert_eq!(filter.domains().len(), 2);
|
||||
assert_eq!(filter.domains()[0], "config");
|
||||
assert_eq!(filter.domains()[1], "logging.runtime");
|
||||
assert!(!filter.is_unrestricted());
|
||||
assert!(crate::OutputFilter::unrestricted().is_unrestricted());
|
||||
let unrestricted = crate::OutputFilter::unrestricted();
|
||||
assert_eq!(unrestricted.level(), crate::LogFilterLevel::Trace);
|
||||
assert_eq!(unrestricted.targets(), &["*".to_string()]);
|
||||
assert_eq!(unrestricted.domains(), &["*".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -74,7 +76,7 @@ fn compatibility_console_constructors_are_unrestricted_human_and_non_ansi() {
|
||||
assert!(stdout.enabled());
|
||||
assert!(!stdout.ansi());
|
||||
assert_eq!(stdout.format(), crate::LogFormat::Human);
|
||||
assert!(stdout.filter().is_unrestricted());
|
||||
assert_eq!(stdout.filter(), &crate::OutputFilter::unrestricted());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -175,21 +177,21 @@ fn validation_rejects_empty_file_paths_and_persistent_ansi() {
|
||||
crate::OutputFilter::unrestricted(),
|
||||
)
|
||||
.with_ansi(true);
|
||||
assert!(
|
||||
crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![empty_directory])
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![empty_prefix])
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![ansi_file])
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
let empty_directory_settings =
|
||||
crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![empty_directory]);
|
||||
let empty_prefix_settings =
|
||||
crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![empty_prefix]);
|
||||
let ansi_file_settings = crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::None, std::vec![ansi_file]);
|
||||
assert!(empty_directory_settings.validate().is_err());
|
||||
assert!(empty_prefix_settings.validate().is_err());
|
||||
assert!(ansi_file_settings.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validation_rejects_ansi_json_console() {
|
||||
let console = crate::ConsoleSettings::new(true, crate::ConsoleOutput::Stdout, true, crate::LogFormat::Json, crate::OutputFilter::unrestricted());
|
||||
let settings = crate::LoggingSettings::new(crate::LogFilterLevel::Info, crate::SpanEvents::Off, std::option::Option::Some(console), std::vec::Vec::new());
|
||||
assert!(settings.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user