use tokmd_progress::{Progress, ProgressBarWithEta};
#[test]
fn w76_progress_disabled_creates_without_panic() {
let _p = Progress::new(false);
}
#[test]
fn w76_progress_enabled_in_ci_creates_without_panic() {
let _p = Progress::new(true);
}
#[test]
fn w76_progress_set_message_borrowed_owned_empty() {
let p = Progress::new(false);
p.set_message("literal &str");
p.set_message(String::from("owned String"));
p.set_message("");
}
#[test]
fn w76_progress_set_message_unicode_and_long() {
let p = Progress::new(false);
p.set_message("analysing...");
p.set_message("a".repeat(100_000));
}
#[test]
fn w76_progress_finish_and_clear_no_panic() {
let p = Progress::new(false);
p.set_message("working");
p.finish_and_clear();
}
#[test]
fn w76_progress_double_finish_is_safe() {
let p = Progress::new(false);
p.finish_and_clear();
p.finish_and_clear();
}
#[test]
fn w76_progress_drop_does_not_panic() {
{
let p = Progress::new(false);
p.set_message("about to drop");
}
}
#[test]
fn w76_bar_zero_total_is_valid() {
let b = ProgressBarWithEta::new(false, 0, "nothing");
b.inc();
b.finish_and_clear();
}
#[test]
fn w76_bar_max_total_is_valid() {
let b = ProgressBarWithEta::new(false, u64::MAX, "enormous");
b.inc();
b.finish_and_clear();
}
#[test]
fn w76_bar_full_operation_sequence() {
let b = ProgressBarWithEta::new(false, 50, "scan");
b.inc();
b.inc_by(5);
b.set_position(20);
b.set_length(100);
b.set_message("halfway");
b.finish_with_message("complete");
b.inc();
b.set_position(0);
b.set_message("post-finish");
b.finish_and_clear();
}
#[test]
fn w76_quiet_full_lifecycle_spinner_and_bar() {
let p = Progress::new(false);
for i in 0..100 {
p.set_message(format!("step {i}"));
}
p.finish_and_clear();
let b = ProgressBarWithEta::new(false, 500, "batch");
for _ in 0..500 {
b.inc();
}
b.finish_with_message("done");
}