Skip to content

Fill test gaps: clipboard clamp, .cell absolute refs, :w! CSV overwrite #80

Description

@garritfra

Problem

A few hot paths and explicitly-documented invariants lack tests. Each is small but high-value because regressions would be silent.

Gaps

  1. clipboard::adjust_formula clamp behaviour (crates/cell-sheet-tui/src/clipboard.rs:43–47) — negative row_delta / col_delta that would push refs below row/col 0 are clamped via .max(0), but this is untested. Off-by-one here silently mis-paste formulas.

  2. .cell round-trip with absolute refs — crates/cell-sheet-core/tests/integration.rs covers basic formula round-trip but not =$A$1+$B$1-style absolute references.

  3. :w! overwriting a .cell formula sheet with CSV — AGENTS.md calls this out as an invariant ("CSV export flattens formulas; the :w! force-save flow is what allows CSV to overwrite a formula sheet"). No test covers the path.

  4. fn_min/fn_max empty-input semantics — both return 0.0 on empty input (intentional, but undocumented by tests). A future maintainer might "fix" it to be consistent with fn_average (which returns #DIV/0!).

Proposed fix

One PR adding ~6 small tests:

  • adjust_formula_row_clamps_to_zero and adjust_formula_col_clamps_to_zero in clipboard.rs.
  • cell_format_preserves_formula_with_absolute_refs in tests/integration.rs.
  • TUI integration test for :w! CSV overwrite of a formula .cell (or document why this lives only in headless tests).
  • min_empty_returns_zero and count_skips_text_and_empty in functions.rs.

Priority

MEDIUM — pure test additions, no risk, locks in current behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt — code health, refactor, test coverage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions