From 1920501e48d445ada870cac85baced3dac21ddac Mon Sep 17 00:00:00 2001 From: z1lk Date: Sun, 8 Jun 2025 11:53:24 -0500 Subject: [PATCH] Fix failure on progress bar render Fixes two potential runtime errors: - `@cursor` overshooting `tests_length` which leads to a negatively-sized "unfinished" portion of the bar - running quickdraw in a directory with no tests, where `progress = (0.0 / 0)` resolves to `Float::NaN` --- lib/quickdraw/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/quickdraw/runner.rb b/lib/quickdraw/runner.rb index b5e025a..720e23d 100644 --- a/lib/quickdraw/runner.rb +++ b/lib/quickdraw/runner.rb @@ -209,7 +209,7 @@ def supervise(worker) end if console - progress = (@cursor * 100.0 / tests_length) + progress = @cursor >= tests_length ? 100.0 : (@cursor * 100.0 / tests_length) print "\r\e[K#{'█' * (progress * bar_width / 100.0).floor}#{'░' * (bar_width - (progress * bar_width / 100.0).floor)} #{progress.round}%" end when Message::Stopping