[PR #13577] progress: add comprehensive test coverage #76572

Open
opened 2026-05-05 09:12:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13577
Author: @yurekami
Created: 12/27/2025
Status: 🔄 Open

Base: mainHead: test/progress-package-tests


📝 Commits (1)

  • dc16acb progress: add comprehensive test coverage

📊 Changes

3 files changed (+670 additions, -0 deletions)

View changed files

progress/bar_test.go (+272 -0)
progress/progress_test.go (+218 -0)
progress/spinner_test.go (+180 -0)

📄 Description

Summary

Add comprehensive test coverage for the progress package, which previously had no tests.

Changes

Added 3 new test files with 33 test functions total:

bar_test.go (12 tests)

  • TestNewBar - creation with various initial values
  • TestBarSet - setting current value
  • TestBarSetOverMax - value clamping at max
  • TestBarPercent - percentage calculation
  • TestBarString - string output format
  • TestBarStringComplete - output when complete
  • TestFormatDuration - duration formatting helper
  • TestRepeat - string repeat helper
  • TestBarRate - rate calculation
  • TestBarRateWithBuckets - rate with multiple samples
  • TestBarBucketThrottle - bucket update throttling
  • TestBarMaxBuckets - bucket count limiting

spinner_test.go (10 tests)

  • TestNewSpinner - spinner creation
  • TestSpinnerSetMessage - message updating
  • TestSpinnerString - string output with message
  • TestSpinnerStringEmpty - output with empty message
  • TestSpinnerStop - stopping spinner
  • TestSpinnerStopIdempotent - idempotent stop behavior
  • TestSpinnerStringAfterStop - output after stop (no spinner char)
  • TestSpinnerMessageWidth - message truncation
  • TestSpinnerParts - animation character verification
  • TestSpinnerValueWraps - value wrapping behavior

progress_test.go (11 tests)

  • TestNewProgress - progress creation
  • TestProgressAdd - adding states
  • TestProgressStop - stop behavior
  • TestProgressStopAndClear - stop and clear behavior
  • TestProgressStopSpinners - spinner cleanup on stop
  • TestProgressRender - rendering output
  • TestProgressMultipleStates - multiple state handling
  • TestProgressWithBar - integration with Bar
  • TestProgressConcurrentAccess - thread safety
  • TestStateInterface - interface compliance
  • TestProgressPosTracking - position tracking

Test plan

  • Tests are self-contained and test behavior, not implementation
  • Tests cover all exported functions
  • Tests verify edge cases (zero values, empty strings, max values)
  • Concurrent access test verifies thread safety

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13577 **Author:** [@yurekami](https://github.com/yurekami) **Created:** 12/27/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/progress-package-tests` --- ### 📝 Commits (1) - [`dc16acb`](https://github.com/ollama/ollama/commit/dc16acb5f93112da545bddc4b3f86b3448c96126) progress: add comprehensive test coverage ### 📊 Changes **3 files changed** (+670 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `progress/bar_test.go` (+272 -0) ➕ `progress/progress_test.go` (+218 -0) ➕ `progress/spinner_test.go` (+180 -0) </details> ### 📄 Description ## Summary Add comprehensive test coverage for the `progress` package, which previously had no tests. ## Changes Added 3 new test files with 33 test functions total: ### `bar_test.go` (12 tests) - `TestNewBar` - creation with various initial values - `TestBarSet` - setting current value - `TestBarSetOverMax` - value clamping at max - `TestBarPercent` - percentage calculation - `TestBarString` - string output format - `TestBarStringComplete` - output when complete - `TestFormatDuration` - duration formatting helper - `TestRepeat` - string repeat helper - `TestBarRate` - rate calculation - `TestBarRateWithBuckets` - rate with multiple samples - `TestBarBucketThrottle` - bucket update throttling - `TestBarMaxBuckets` - bucket count limiting ### `spinner_test.go` (10 tests) - `TestNewSpinner` - spinner creation - `TestSpinnerSetMessage` - message updating - `TestSpinnerString` - string output with message - `TestSpinnerStringEmpty` - output with empty message - `TestSpinnerStop` - stopping spinner - `TestSpinnerStopIdempotent` - idempotent stop behavior - `TestSpinnerStringAfterStop` - output after stop (no spinner char) - `TestSpinnerMessageWidth` - message truncation - `TestSpinnerParts` - animation character verification - `TestSpinnerValueWraps` - value wrapping behavior ### `progress_test.go` (11 tests) - `TestNewProgress` - progress creation - `TestProgressAdd` - adding states - `TestProgressStop` - stop behavior - `TestProgressStopAndClear` - stop and clear behavior - `TestProgressStopSpinners` - spinner cleanup on stop - `TestProgressRender` - rendering output - `TestProgressMultipleStates` - multiple state handling - `TestProgressWithBar` - integration with Bar - `TestProgressConcurrentAccess` - thread safety - `TestStateInterface` - interface compliance - `TestProgressPosTracking` - position tracking ## Test plan - [x] Tests are self-contained and test behavior, not implementation - [x] Tests cover all exported functions - [x] Tests verify edge cases (zero values, empty strings, max values) - [x] Concurrent access test verifies thread safety 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 09:12:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#76572