From ff3ac137eda1f20bbdc339bd758301d3082f6636 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 29 Aug 2020 17:15:21 +0200 Subject: Don't parse arguments during `cargo test` (#37) Otherwise, running the tests with special arguments (e.g. `cargo test -- --test-threads 1`) will break. --- src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.rs b/src/main.rs index d241b58..2a2cf9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,10 +36,21 @@ struct Configuration { input: String, } +#[cfg(not(test))] lazy_static! { static ref CONFIGURATION: Configuration = parse_arguments(); } +#[cfg(test)] +lazy_static! { + static ref CONFIGURATION: Configuration = Configuration { + radian_mode: false, + fix: 10, + base: 10, + input: "".to_string(), + }; +} + fn main() { if !CONFIGURATION.input.is_empty() { // command mode // -- cgit v1.2.3