From a178b8801fe312a9eaeef93d72911223740d445e Mon Sep 17 00:00:00 2001 From: markxoe Date: Tue, 4 Jun 2024 16:16:17 +0200 Subject: [PATCH] wip: add test cfg for progress stuff --- src/indication.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/indication.rs b/src/indication.rs index 9dae94a..f8b5db7 100644 --- a/src/indication.rs +++ b/src/indication.rs @@ -1,4 +1,3 @@ -#![allow(dead_code)] // todo: remove this when tests are implemented use std::time::Duration; use indicatif::{ProgressBar, ProgressStyle}; @@ -73,6 +72,7 @@ impl ProgressReporter { } } + #[cfg(test)] pub fn new_empty() -> Self { Self { progress: None, @@ -106,6 +106,7 @@ impl ProgressReporter { enum ProgressType { Progress, Spinner, + #[cfg(test)] Empty, } @@ -119,6 +120,7 @@ pub struct ProgressBuilder { } impl ProgressBuilder { + #[cfg(test)] pub fn empty() -> Self { Self { bar_type: ProgressType::Empty, @@ -129,6 +131,7 @@ impl ProgressBuilder { step: None, } } + pub fn new() -> Self { Self { bar_type: ProgressType::Progress, @@ -172,6 +175,7 @@ impl ProgressBuilder { self } + #[cfg(test)] fn build_empty(self) -> ProgressReporter { ProgressReporter::new_empty() } @@ -202,6 +206,7 @@ impl ProgressBuilder { match self.bar_type { ProgressType::Progress => self.build_progress(), ProgressType::Spinner => self.build_spinner(), + #[cfg(test)] ProgressType::Empty => self.build_empty(), } }