Skip to content

Commit

Permalink
wip: add test cfg for progress stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
markxoe committed Jun 4, 2024
1 parent 49b0df8 commit a178b88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/indication.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(dead_code)] // todo: remove this when tests are implemented
use std::time::Duration;

use indicatif::{ProgressBar, ProgressStyle};
Expand Down Expand Up @@ -73,6 +72,7 @@ impl ProgressReporter {
}
}

#[cfg(test)]
pub fn new_empty() -> Self {
Self {
progress: None,
Expand Down Expand Up @@ -106,6 +106,7 @@ impl ProgressReporter {
enum ProgressType {
Progress,
Spinner,
#[cfg(test)]
Empty,
}

Expand All @@ -119,6 +120,7 @@ pub struct ProgressBuilder {
}

impl ProgressBuilder {
#[cfg(test)]
pub fn empty() -> Self {
Self {
bar_type: ProgressType::Empty,
Expand All @@ -129,6 +131,7 @@ impl ProgressBuilder {
step: None,
}
}

pub fn new() -> Self {
Self {
bar_type: ProgressType::Progress,
Expand Down Expand Up @@ -172,6 +175,7 @@ impl ProgressBuilder {
self
}

#[cfg(test)]
fn build_empty(self) -> ProgressReporter {
ProgressReporter::new_empty()
}
Expand Down Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit a178b88

Please sign in to comment.