MCPcopy Create free account
hub / github.com/github/gh-aw / TestProgressBarEdgeCases

Function TestProgressBarEdgeCases

pkg/console/progress_test.go:266–295  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

264}
265
266func TestProgressBarEdgeCases(t *testing.T) {
267 t.Run("current exceeds total", func(t *testing.T) {
268 bar := NewProgressBar(100)
269 output := bar.Update(150)
270
271 assert.NotEmpty(t, output, "Should handle current exceeding total gracefully")
272
273 // In non-TTY mode, percentage will be > 100
274 if !isTTY() {
275 assert.Contains(t, output, "150%", "Should show percentage > 100")
276 }
277 })
278
279 t.Run("negative current value", func(t *testing.T) {
280 bar := NewProgressBar(100)
281 output := bar.Update(-10)
282
283 assert.NotEmpty(t, output, "Should handle negative values gracefully")
284 })
285
286 t.Run("very small progress increments", func(t *testing.T) {
287 bar := NewProgressBar(1000000)
288
289 // Update with very small increments
290 for i := range int64(11) {
291 output := bar.Update(i)
292 assert.NotEmpty(t, output, "Should handle very small increments")
293 }
294 })
295}
296
297func TestProgressBarConcurrency(t *testing.T) {
298 t.Run("multiple updates are safe", func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

UpdateMethod · 0.95
NewProgressBarFunction · 0.70
isTTYFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected