src/logger/tests.rs
Lines
100.00 %
Functions
100.00 %
Regions
100.00 %
| Line | Count | Source |
|---|---|---|
| 1 | // | |
| 2 | // File Name: tests.rs | |
| 3 | // Directory: src/logger | |
| 4 | // Project Name: flogging | |
| 5 | // | |
| 6 | // Copyright (C) 2025 Bradley Willcott | |
| 7 | // | |
| 8 | // SPDX-License-Identifier: GPL-3.0-or-later | |
| 9 | // | |
| 10 | // This library (crate) is free software: you can redistribute it and/or modify | |
| 11 | // it under the terms of the GNU General Public License as published by | |
| 12 | // the Free Software Foundation, either version 3 of the License, or | |
| 13 | // (at your option) any later version. | |
| 14 | // | |
| 15 | // This library (crate) is distributed in the hope that it will be useful, | |
| 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | // GNU General Public License for more details. | |
| 19 | // | |
| 20 | // You should have received a copy of the GNU General Public License | |
| 21 | // along with this library (crate). If not, see <https://www.gnu.org/licenses/>. | |
| 22 | // | |
| 23 | ||
| 24 | //! | |
| 25 | //! # Logger Tests | |
| 26 | //! | |
| 27 | ||
| 28 | use super::*; | |
| 29 | ||
| 30 | #[test] | |
| 31 | 1 | fn has_handler() { |
| 32 | use super::*; | |
| 33 | ||
| 34 | 1 | let mut= ::(module_path!()); |
| 35 | 1 | info("Some text to store."); |
| 36 | ||
| 37 | 1 | assert!(has_handler(::)); |
| 38 | 1 | } |
| 39 | ||
| 40 | #[test] | |
| 41 | 1 | fn get_handler() { |
| 42 | use super::*; | |
| 43 | ||
| 44 | 1 | let mut= ::(module_path!()); |
| 45 | 1 | set_fn_name("get_handler"); |
| 46 | ||
| 47 | 1 | info("Some text to store."); |
| 48 | ||
| 49 | 1 | assert!(get_handler(::)is_some()); |
| 50 | 1 | assert!(get_handler(::)is_none()); |
| 51 | 1 | } |
| 52 | ||
| 53 | #[test] | |
| 54 | 1 | fn is_logging() { |
| 55 | 1 | let mut= ::(module_path!()); |
| 56 | 1 | set_fn_name("is_logging"); |
| 57 | ||
| 58 | 1 | assert!(is_logging()); |
| 59 | 1 | assert!(is_loggable(&::WARNING)); |
| 60 | ||
| 61 | 1 | set_level(::OFF); |
| 62 | 1 | assert!(!is_logging()); |
| 63 | 1 | assert!(!is_loggable(&::WARNING)); |
| 64 | 1 | } |