mirror of
https://gitee.com/openharmony/third_party_rust_log
synced 2024-11-23 07:40:08 +00:00
fix tests when running with --all-features
This commit is contained in:
parent
525336f364
commit
c68890197d
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -37,6 +37,8 @@ jobs:
|
||||
rustup update ${{ matrix.rust }} --no-self-update
|
||||
rustup default ${{ matrix.rust }}
|
||||
- run: cargo test --verbose
|
||||
- run: cargo test --verbose --no-default-features
|
||||
- run: cargo test --verbose --all-features
|
||||
- run: cargo test --verbose --features serde
|
||||
- run: cargo test --verbose --features std
|
||||
- run: cargo test --verbose --features kv_unstable
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(dead_code, unused_imports)]
|
||||
|
||||
#[cfg(not(lib_build))]
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
@ -32,6 +34,23 @@ impl Log for Logger {
|
||||
|
||||
#[cfg_attr(lib_build, test)]
|
||||
fn main() {
|
||||
// These tests don't really make sense when static
|
||||
// max level filtering is applied
|
||||
#[cfg(not(any(
|
||||
feature = "max_level_off",
|
||||
feature = "max_level_error",
|
||||
feature = "max_level_warn",
|
||||
feature = "max_level_info",
|
||||
feature = "max_level_debug",
|
||||
feature = "max_level_trace",
|
||||
feature = "max_level_off",
|
||||
feature = "max_level_error",
|
||||
feature = "max_level_warn",
|
||||
feature = "max_level_info",
|
||||
feature = "max_level_debug",
|
||||
feature = "max_level_trace",
|
||||
)))]
|
||||
{
|
||||
let me = Arc::new(State {
|
||||
last_log: Mutex::new(None),
|
||||
});
|
||||
@ -44,6 +63,7 @@ fn main() {
|
||||
test(&a, LevelFilter::Info);
|
||||
test(&a, LevelFilter::Debug);
|
||||
test(&a, LevelFilter::Trace);
|
||||
}
|
||||
}
|
||||
|
||||
fn test(a: &State, filter: LevelFilter) {
|
||||
|
Loading…
Reference in New Issue
Block a user