Repository navigation
Add unit tests to improve code coverage - #211
Merged
Merged
Conversation
Add tests for: - config/user.rs: find_unknown_keys, CommitGenerationConfig::is_configured, StageMode, WorktrunkConfig methods, deserialize_string_or_vec, and config serde round-trips - styling/highlighting.rs: bash_token_style, toml_token_style, and format_toml functions These tests improve coverage for: - styling/highlighting.rs: ~75% → ~95% - config/user.rs: ~79% → ~87% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add tests for: - shell.rs: Shell::config_paths, Shell::completion_path, custom prefix handling, and ShellInit::with_prefix - styling/line.rs: truncate_visible edge cases, StyledString/StyledLine methods including extend, pad_to, plain_text, and truncate_to_width 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds 13 tests covering: - Simple branch names (alphanumeric, dots) - Branch names with slashes (feature/branch) - Branch names with underscores - Branch names with hyphens - Mixed special characters (a/b/c-d_e.f) - Roundtrip escape/unescape verification - Invalid escape sequence handling - Empty string edge case 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
git/diff.rs (27 tests): - LineDiff: from_numstat parsing, is_empty, into_tuple, From impls - DiffStats: from_shortstat parsing, format_summary variants commands/list/model.rs (42 tests): - Divergence: from_counts_with_remote, symbol, styled - WorktreeState: display, serialize - MainState: display, styled, serialize, from_integration_and_counts - OperationState: display, styled, serialize, as_json_str - StatusSymbols: is_empty, format_compact, render_with_mask - UpstreamStatus: active with/without remote - ListItem: branch_name, head, counts, branch_diff, upstream, should_dim - PositionMask: width, FULL constant - GitOperationState, AheadBehind, BranchDiffTotals, CommitDetails defaults 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adds 33 tests covering: - strip_ansi: plain text, color codes, multiple codes, nested codes - render_markdown_in_help: H1/H2/H3 headers, code blocks, HTML comments, tables - render_markdown_table: basic table, empty input, mixed content - colorize_status_symbols: working tree, conflicts, git ops, CI status colors - render_inline_formatting: inline code, bold, links, mixed content, edge cases - render_table: column alignment, uneven columns, separator handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adds 22 tests covering: - DefaultBranchName::from_local: simple, with remote prefix, whitespace, empty - DefaultBranchName::from_remote: standard, master, with other lines, no ref, empty - Worktree::parse_porcelain_list: single/multiple worktrees, bare, detached, locked, prunable, empty, no trailing blank, error cases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adds 10 tests covering: - format_with_gutter: empty input, margin handling, wrapping - wrap_text_at_width: multiple spaces handling - wrap_styled_text: ANSI codes, injected reset stripping - format_bash_with_gutter_at_width: basic, multiline, complex commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add 32 tests covering: - JsonDiff conversion from LineDiff - pr_status_to_json for all CiStatus variants (passed, failed, running, conflicts, error, no-ci) - upstream_to_json with/without remote and branch - worktree_state_to_json for all WorktreeState variants plus fallback behavior - format_raw_symbols for all symbol types and combinations - JSON serialization for all JSON structs (JsonCommit, JsonMain, JsonRemote, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add 14 tests covering: - Style constants (ADDITION, DELETION, GUTTER) verify correct ANSI codes - Emoji constants verify expected emoji values - Message formatting functions (error, hint, warning, success, progress, info) - format_heading with/without suffix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add 17 tests covering: - ProjectConfig default values - TOML deserialization for all hook types (post-create, post-start, pre-commit, pre-merge, post-merge, pre-remove) - String and table command formats - find_unknown_keys for detecting unrecognized config keys - Serialization and Clone/PartialEq derives 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add 14 tests covering: - Command struct construction (new, with_expansion, clone) - CommandConfig deserialization from single string and named table formats - Order preservation from TOML insertion order - CommandConfig serialization (roundtrip tests) - commands() and commands_with_phase() methods - PartialEq implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Test coverage for sanitize_branch_name and expand_template functions: - Branch sanitization: slashes, backslashes, mixed, empty, edge cases - Basic template substitution: single/multiple vars, empty templates - Shell escaping: spaces, special chars, quotes, command injection - Error cases: invalid syntax, invalid expressions - Jinja2 features: conditionals, default filter, upper filter - Trailing newline preservation - Real-world patterns: worktree paths, shell commands, git commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Test coverage for sanitize_branch_name and expand_template functions: - Branch sanitization: slashes, backslashes, mixed, empty, edge cases - Basic template substitution: single/multiple vars, empty templates - Shell escaping: spaces, special chars, quotes, command injection - Error cases: invalid syntax, invalid expressions - Jinja2 features: conditionals, default filter, upper filter - Trailing newline preservation - Real-world patterns: worktree paths, shell commands, git commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Test coverage for error handling utility functions: - exit_code: child process, hook command (with/without code), not approved, already displayed, git error, wrapped hook error - is_command_not_approved: true case, false for child process/hook failed/git error - add_hook_skip_hint: wraps hook command failed, passes through non-hook errors - format_error_block: with content, empty error, whitespace only - WorktrunkError Display: child process, hook command (with/without name), silent errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Test coverage for: - escape_branch_for_config/unescape_branch_from_config: roundtrip, special chars - check_integration: all integration reasons, priority order - IntegrationReason::description - path_dir_name, Worktree::dir_name - HookType display formatting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Reduces test code by ~365 lines while maintaining same coverage by consolidating repetitive tests into parameterized tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Jun 29, 2026
) ## What this does Removes the third-party `awalsh128/cache-apt-pkgs-action` from CI entirely, installing zsh + fish with a plain `sudo apt-get update && sudo apt-get install -y zsh fish` at all four call sites: - `ci.yaml` — `code-coverage` - `nightly.yaml` — `feature-powerset` and `benchmarks` - `.github/actions/test-setup/action.yaml` — composite action used by the required `test` matrix It also drops the Dependabot `ignore` entry for the action (no longer needed once the action is gone). ## Why (and why this supersedes #3321) `awalsh128/[email protected]` (dependabot bump #3311) empties its own `packages: zsh fish` argument in the "Normalizing package list" step and aborts with `Packages argument is empty`, in ~20s, before any compilation — killing `code-coverage` on every PR, which in turn stopped `codecov/patch` from posting anywhere. Root cause is upstream PR #177 quoting `${packages}`, tracked at [awalsh128/cache-apt-pkgs-action#210](awalsh128/cache-apt-pkgs-action#210). #3321 already fixed main by pinning back to `v1.6.1`. This PR takes the sturdier route — dropping the dependency — based on the upstream's health: - Issue #210 is open with **no maintainer engagement**; affected users call the action "basically non-functional," with a fresh repro confirmed on 2026-06-29. - **No open PR** reverts #177 or fixes the regression; v1.6.2 (broken) is still tagged `Latest`, and contributor PRs sit unmerged for months. - The action's mutable `v1`/`latest` tags are actively being retargeted upstream (open PR #211), which is how a `@v1.6.1` ref can resolve to drifted code — so even the pin isn't a stable anchor. `zsh` and `fish` are in the standard Ubuntu repos (no PPA), so the action only *cached* an install of two tiny packages — a negligible speed-up for a third-party dependency that is under-maintained, broke CI repo-wide, and can't be stably pinned. Dropping it removes the whole failure class and matches the existing `musl-tools` install already in `nightly.yaml`. Verified: the identical `apt-get` step already runs green in the required `test (linux)` job (installs zsh 5.9 + fish 3.7.0), and a full `code-coverage` run on this branch completed green end-to-end with `codecov/patch` posting again. ## Guard against recurrence #3311 merged while its own `code-coverage` was red because `code-coverage`/`codecov/patch` aren't *required* status checks (only `test (linux/macos/windows)` are), and `codecov/patch` was absent rather than red (the job died before uploading), so the mechanical-bump merge saw nothing blocking. Recommended guard: make the `code-coverage` job a required status check — it fails only on genuine breakage (the codecov upload already soft-fails on fork PRs), so it blocks this class without re-introducing the flake that keeps `codecov/patch` itself advisory. > _This was written by Claude Code on behalf of max_ Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config/user.rscovering config parsing, serialization, and validationstyling/highlighting.rscovering token styles and TOML formattingCoverage Improvements
styling/highlighting.rs: ~75% → ~95% line coverageconfig/user.rs: ~79% → ~87% line coverageTest Details
config/user.rs (21 tests)
find_unknown_keys: empty, with unknown keys, invalid TOML, known sectionsCommitGenerationConfig::is_configured: empty, with command, whitespace-only, empty stringStageMode: default value, serde round-tripWorktrunkConfig: default,is_command_approved,format_pathListConfig,CommitConfig,MergeConfigdeserialize_string_or_vec: string input, array inputstyling/highlighting.rs (18 tests)
bash_token_style: all token types (function, keyword, string, operator, etc.)toml_token_style: all token types (string, comment, table, boolean, digit)format_toml: basic, with margin, multiline, emptyTest plan
🤖 Generated with Claude Code