Skip to content

test: cover error paths, boundary cases, and regressions - #5

Merged
kusutori merged 2 commits into
mainfrom
codex/list-untested-error-paths-and-write-test-cases
May 6, 2026
Merged

kusutori merged 2 commits into
mainfrom
codex/list-untested-error-paths-and-write-test-cases

Conversation

@kusutori

@kusutori kusutori commented May 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Strengthen non-happy-path coverage for core flows by exercising error branches that were previously untested.
  • Prefer typed error assertions (errors.Is / errors.As) instead of fragile string comparisons to ensure robust error handling.
  • Add boundary and regression tests to prevent regressions for previously flaky behaviors (invalid config, interrupted downloads, permission semantics).

Description

  • Added invalid-TOML parsing test TestLoadInvalidTOML to internal/config/config_test.go to cover config parse failures.
  • Added cache negative and boundary tests to internal/cache/cache_test.go, including TestCachePut_SourceMissing_UsesWrappedError, TestCacheRemove_NotFound, and TestCacheGetPath_BoundaryInputs, and updated imports to use errors and strings.
  • Added download error-path tests to internal/download/download_test.go, including TestDownloadFile_HTTPNon2xx and TestDownloadFile_InvalidURL_Regression, and adjusted existing tests to avoid duplicate names.
  • Added GitHub API rate-limit assertion TestGetLatestRelease_RateLimitError to internal/github/api_test.go using errors.As against *github.RateLimitError.
  • Added install-path regression and error-assertion tests to internal/install/install_test.go, including TestRegression_Install_PermissionDeniedOnExistingTarget and TestInstallAppImage_DownloadFailureUsesErrorsIs, and exercised downloadFileFunc hooks for deterministic failures.

Testing

  • Ran the full test suite with go test ./..., which completed successfully after fixes to test imports and duplicate test names.
  • Targeted packages exercised include internal/cache, internal/config, internal/download, internal/github, and internal/install, and their tests passed in the final run.

Codex Task

@kusutori
kusutori merged commit a1a16fa into main May 6, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant