Skip to content

Commit 4fa040c

Browse files
committed
Rename full_bar_threshold to progress_bar_threshold
- Renamed `full_bar_threshold` parameter to `progress_bar_threshold` for consistency with new naming scheme - Renamed `_FULL_BAR_THRESHOLD` constant to `_PROGRESS_BAR_THRESHOLD` - Updated _bar_width function signature and docstring - Updated _make_default_on_test_done to use progress_bar_threshold - Updated _format_progress_line to use progress_bar_threshold - Updated documentation in test-runner.md parameter table - Updated BREAKINGS.md with migration note for parameter rename - Updated CHANGELOGS.md for v0.18.14-beta - All tests pass (214/214)
1 parent f6ba022 commit 4fa040c

5 files changed

Lines changed: 26 additions & 24 deletions

File tree

BREAKINGS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This document outlines all breaking changes introduced in CTBase v0.18.0-beta co
55
## Non-breaking note (0.18.14-beta)
66

77
- **TestRunner progress display refactoring**: Renamed `progress` parameter to `show_progress_line` for clarity, and added new `show_progress_bar` parameter for granular control. Users with `progress=false` should change to `show_progress_line=false`. Users with `progress=true` (default) can keep using defaults or set `show_progress_line=true, show_progress_bar=false` for minimal display without the graphical bar. No breaking changes; purely parameter rename with backward-compatible defaults. Migration: replace `progress=` with `show_progress_line=`.
8+
- **Parameter rename**: Renamed `full_bar_threshold` to `progress_bar_threshold` for clarity and consistency with new naming scheme. Users with `full_bar_threshold=` should change to `progress_bar_threshold=`. No breaking changes; purely parameter rename with backward-compatible defaults. Migration: replace `full_bar_threshold=` with `progress_bar_threshold=`.
89

910
## Non-breaking note (0.18.13-beta)
1011

CHANGELOGS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- **Parameter rename**: Renamed `progress` to `show_progress_line` for clearer semantics
1515
- **Granular control**: Added `show_progress_bar` parameter to control only the graphical bar `[█░░░...]`
1616
- **Minimal display**: Users can now set `show_progress_line=true, show_progress_bar=false` to display `✓ [01/76] suite/test.jl (0.2s)` without the graphical bar
17+
- **Parameter rename**: Renamed `full_bar_threshold` to `progress_bar_threshold` for consistency with new naming scheme
1718
- **Documentation updated**: TestRunner guide updated with new parameter names and examples
1819
- **Tests updated**: Added tests for `show_progress_bar=false` behavior
1920

docs/src/guide/test-runner.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ CTBase.run_tests(;
7575
| `on_test_done` | `Function` or `nothing` | `nothing` | Callback after eval (see [Callbacks](@ref)) |
7676
| `show_progress_line` | `Bool` | `true` | Show progress line with symbol, index, spec, and time. Ignored when `on_test_done` is provided |
7777
| `show_progress_bar` | `Bool` | `true` | Show graphical progress bar `[█░░░...]` within the line |
78-
| `full_bar_threshold` | `Int` | `100` | Maximum tests for full-resolution progress bar (see [Progress Bar](@ref)) |
78+
| `progress_bar_threshold` | `Int` | `100` | Maximum tests for full-resolution progress bar (see [Progress Bar](@ref)) |
7979

8080
## Writing Test Files
8181

@@ -156,14 +156,14 @@ The bar width adapts to the number of tests:
156156
- **≤ 100 tests** (default): width equals the total number of tests (one block per test).
157157
- **> 100 tests** (default): fixed width of 100 characters. Some tests will not visually advance the bar (the fill is computed as `round(Int, index / total * 100)`).
158158

159-
The threshold can be customized via the `full_bar_threshold` parameter:
159+
The threshold can be customized via the `progress_bar_threshold` parameter:
160160

161161
```julia
162162
# Use a smaller threshold for narrow terminals
163-
CTBase.run_tests(; args=String.(ARGS), full_bar_threshold=30)
163+
CTBase.run_tests(; args=String.(ARGS), progress_bar_threshold=30)
164164

165165
# Use a larger threshold for wide displays
166-
CTBase.run_tests(; args=String.(ARGS), full_bar_threshold=100)
166+
CTBase.run_tests(; args=String.(ARGS), progress_bar_threshold=100)
167167
```
168168

169169
### Cursor-style display

ext/TestRunner.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Run tests with configurable file/function name builders and optional available t
105105
- `on_test_done::Union{Function,Nothing}`: Callback after eval (default: `nothing`)
106106
- `show_progress_line::Bool`: Show progress line with symbol, index, spec, and time (default: `true`)
107107
- `show_progress_bar::Bool`: Show graphical progress bar `[█░░░...]` within the line (default: `true`)
108-
- `full_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
108+
- `progress_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
109109
110110
# Returns
111111
- `Nothing`: Tests are executed via side effects
@@ -149,7 +149,7 @@ function CTBase.run_tests(
149149
on_test_done::Union{Function,Nothing}=nothing,
150150
show_progress_line::Bool=true,
151151
show_progress_bar::Bool=true,
152-
full_bar_threshold::Int=_FULL_BAR_THRESHOLD,
152+
progress_bar_threshold::Int=_PROGRESS_BAR_THRESHOLD,
153153
)
154154
# Guard: a subdirectory named "test" inside test_dir would conflict with
155155
# the automatic `test/` prefix stripping in _parse_test_args.
@@ -184,7 +184,7 @@ function CTBase.run_tests(
184184
effective_on_test_done = if on_test_done !== nothing
185185
on_test_done
186186
elseif show_progress_line
187-
_make_default_on_test_done(stdout, total, full_bar_threshold, show_progress_bar)
187+
_make_default_on_test_done(stdout, total, progress_bar_threshold, show_progress_bar)
188188
else
189189
nothing
190190
end
@@ -969,17 +969,17 @@ end
969969
# ============================================================================
970970

971971
"""
972-
_FULL_BAR_THRESHOLD
972+
_PROGRESS_BAR_THRESHOLD
973973
974974
Internal constant defining the maximum number of tests for full-resolution progress bars.
975975
976-
When the total number of tests is ≤ `_FULL_BAR_THRESHOLD` (100), the progress bar displays
976+
When the total number of tests is ≤ `_PROGRESS_BAR_THRESHOLD` (100), the progress bar displays
977977
one character per test with cumulative coloring (each test gets its own colored block).
978978
Beyond this threshold, the bar switches to compressed mode with uniform coloring.
979979
980980
This threshold balances visual clarity with terminal width constraints.
981981
"""
982-
const _FULL_BAR_THRESHOLD = 100
982+
const _PROGRESS_BAR_THRESHOLD = 100
983983

984984
"""
985985
$(TYPEDSIGNATURES)
@@ -1030,12 +1030,12 @@ $(TYPEDSIGNATURES)
10301030
10311031
Compute the progress bar character width based on the number of tests.
10321032
1033-
- `total ≤ full_bar_threshold`: width equals `total` (one block per test).
1034-
- `total > full_bar_threshold`: fixed width of `full_bar_threshold` (some tests skip a block advance).
1033+
- `total ≤ progress_bar_threshold`: width equals `total` (one block per test).
1034+
- `total > progress_bar_threshold`: fixed width of `progress_bar_threshold` (some tests skip a block advance).
10351035
10361036
# Arguments
10371037
- `total::Int`: Total number of tests
1038-
- `full_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
1038+
- `progress_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
10391039
10401040
# Returns
10411041
- `Int`: Character width for the progress bar (0 if `total ≤ 0`)
@@ -1053,13 +1053,13 @@ julia> TestRunner._bar_width(25)
10531053
julia> TestRunner._bar_width(0)
10541054
0
10551055
1056-
julia> TestRunner._bar_width(100, full_bar_threshold=30)
1056+
julia> TestRunner._bar_width(100, progress_bar_threshold=30)
10571057
30
10581058
```
10591059
"""
1060-
function _bar_width(total::Int, full_bar_threshold::Int=_FULL_BAR_THRESHOLD)
1060+
function _bar_width(total::Int, progress_bar_threshold::Int=_PROGRESS_BAR_THRESHOLD)
10611061
total <= 0 && return 0
1062-
return min(total, full_bar_threshold)
1062+
return min(total, progress_bar_threshold)
10631063
end
10641064

10651065
"""
@@ -1166,7 +1166,7 @@ Uses ANSI colors: green for success, red for errors, yellow for skipped.
11661166
- `info::TestRunInfo`: Test execution information
11671167
- `history::Union{Vector{Int},Nothing}`: Optional history array for per-test coloring (default: `nothing`)
11681168
- `cumulative_severity::Union{Int,Nothing}`: Optional cumulative severity for coloring (default: `nothing`)
1169-
- `full_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
1169+
- `progress_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
11701170
- `show_progress_bar::Bool`: Show graphical progress bar `[█░░░...]` (default: `true`)
11711171
11721172
# Notes
@@ -1200,7 +1200,7 @@ function _format_progress_line(
12001200
info::TestRunInfo;
12011201
history::Union{Vector{Int},Nothing}=nothing,
12021202
cumulative_severity::Union{Int,Nothing}=nothing,
1203-
full_bar_threshold::Int=_FULL_BAR_THRESHOLD,
1203+
progress_bar_threshold::Int=_PROGRESS_BAR_THRESHOLD,
12041204
show_progress_bar::Bool=true,
12051205
)
12061206
# ANSI codes
@@ -1212,7 +1212,7 @@ function _format_progress_line(
12121212
yellow = "\e[33m"
12131213
cyan = "\e[36m"
12141214

1215-
bar_width = _bar_width(info.total, full_bar_threshold)
1215+
bar_width = _bar_width(info.total, progress_bar_threshold)
12161216
bar = _progress_bar(info.index, info.total; width=bar_width)
12171217

12181218
severity = _severity(info.status)
@@ -1305,7 +1305,7 @@ Create a stateful progress callback for `on_test_done`. Prints to `io`.
13051305
# Arguments
13061306
- `io::IO`: Output stream for progress display
13071307
- `total::Int`: Total number of tests
1308-
- `full_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
1308+
- `progress_bar_threshold::Int`: Maximum tests for full-resolution progress bar (default: `100`)
13091309
- `show_progress_bar::Bool`: Show graphical progress bar `[█░░░...]` (default: `true`)
13101310
13111311
# Returns
@@ -1337,8 +1337,8 @@ julia> cb(info)
13371337
[█████░░░░░░░░░░░] ✓ [05/10] test_example (1.2s)
13381338
```
13391339
"""
1340-
function _make_default_on_test_done(io::IO, total::Int, full_bar_threshold::Int=_FULL_BAR_THRESHOLD, show_progress_bar::Bool=true)
1341-
history = total <= full_bar_threshold ? fill(0, total) : Int[]
1340+
function _make_default_on_test_done(io::IO, total::Int, progress_bar_threshold::Int=_PROGRESS_BAR_THRESHOLD, show_progress_bar::Bool=true)
1341+
history = total <= progress_bar_threshold ? fill(0, total) : Int[]
13421342
max_severity = Ref{Int}(0)
13431343

13441344
function update(info::TestRunInfo)
@@ -1352,7 +1352,7 @@ function _make_default_on_test_done(io::IO, total::Int, full_bar_threshold::Int=
13521352
info;
13531353
history=!isempty(history) ? history : nothing,
13541354
cumulative_severity=max_severity[],
1355-
full_bar_threshold=full_bar_threshold,
1355+
progress_bar_threshold=progress_bar_threshold,
13561356
show_progress_bar=show_progress_bar,
13571357
)
13581358
return nothing

test/suite/extensions/test_testrunner.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function test_testrunner()
402402
@test bar_width(0) == 0
403403
end
404404

405-
@testset "_bar_width with custom full_bar_threshold" begin
405+
@testset "_bar_width with custom progress_bar_threshold" begin
406406
# Custom threshold of 30
407407
@test bar_width(1, 30) == 1
408408
@test bar_width(10, 30) == 10

0 commit comments

Comments
 (0)