1 //! Do not put multiple tests in this file. Tests in the same file run in the 2 //! same executable, so if there are several tests in one file, only one test 3 //! will successfully be able to initialize the logger. 4 5 use std::env; 6 7 #[test] config_log_max_level()8fn config_log_max_level() { 9 // Environment variables should be overwritten by config values. 10 env::set_var("RUST_LOG", "debug"); 11 12 let init_result = 13 logger::init(logger::Config::default().with_max_level(log::LevelFilter::Trace)); 14 15 assert!(init_result); 16 // Setting the level through the Config struct should impact both host and device 17 assert_eq!(log::max_level(), log::LevelFilter::Trace); 18 19 env::remove_var("RUST_LOG"); 20 } 21