Skip to content

Add unit tests for the CLI progress-bar renderer (render_progress_bar) #81

Description

@tsouth89

Context

render_progress_bar(percent, width, use_color) in rust/src/cli/usage.rs:548 renders an ASCII bar of / inside [...], clamping non-finite/out-of-range input. With use_color = false it is fully deterministic. usage.rs already has a #[cfg(test)] mod tests, so new cases slot right in.

Task

Add unit tests for render_progress_bar in the existing test module.

Acceptance criteria

  • With use_color = false: assert exact strings for 0%, 50%, 100% at a fixed width (e.g. 10).
  • Assert non-finite input (f64::NAN) renders as empty (0%).
  • Assert >100 clamps to full and <0 clamps to empty.
  • No ANSI codes asserted for the use_color = false path.

How to test

cargo test --manifest-path rust/Cargo.toml

Pointers

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is neededrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions