Skip to content

refactor(tests): extract string_memory_bugs.cpp (re-target of #3146) - #3165

Merged
zackees merged 1 commit into
masterfrom
feat/3131-string-memory-bugs-extract
Jun 16, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3131-string-memory-bugs-extract

Conversation

@zackees

@zackees zackees commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Re-opening of #3146. Part of #3131.

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for memory safety and capacity handling in string operations.

… of #3131)

First extraction in #3131 (string.cpp split, sub-issue of #3127). Moves
the smallest section (lines 3898-4271 of original, 'Tests from
string_memory_bugs.cpp') into its own file.

Content moved (375 LOC):
  - StringHolder - Capacity off-by-one bugs
  - StringHolder - hasCapacity checks
  - StringHolder - Edge cases exposing capacity bugs
  - StringHolder - Memory safety with incorrect capacity

Tests pass: bash test fl_stl_string --cpp (1/1, 0.26s test time, 80s
build).

string.cpp: 6,468 -> 6,093 LOC
string_memory_bugs.cpp (new): 389 LOC

Stacked on feat/3130-fixed-point-test-helpers-header (PR #3144) for the
sibling-split hook update introduced in #3135.

Part of #3131. Meta tracking issue: #3127.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit d323d3c into master Jun 16, 2026
4 checks passed
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8f53ee33-1be6-4227-a652-688b48f430d8

📥 Commits

Reviewing files that changed from the base of the PR and between 471b203 and 44922c3.

📒 Files selected for processing (2)
  • tests/fl/stl/string.cpp
  • tests/fl/stl/string_memory_bugs.cpp

📝 Walkthrough

Walkthrough

Extracts the StringHolder capacity and memory-safety test cases that were previously embedded in tests/fl/stl/string.cpp into a new dedicated file tests/fl/stl/string_memory_bugs.cpp. No test logic is removed; the same four test groups are re-established in the new translation unit.

Changes

StringHolder Memory-Bug Test Extraction

Layer / File(s) Summary
Remove embedded block from string.cpp
tests/fl/stl/string.cpp
Deletes the 375-line consolidated string_memory_bugs.cpp section (all four FL_TEST_CASE groups) so string.cpp transitions directly from regression/debug tests to string_optimization.cpp.
New string_memory_bugs.cpp translation unit
tests/fl/stl/string_memory_bugs.cpp
Adds 389 lines: includes/framework setup, StringHolder - Capacity off-by-one bugs (constructor/growth/copy subcases), StringHolder - hasCapacity checks (reserve/write/capacity tracking), StringHolder - Edge cases exposing capacity bugs (boundary lengths 0/1/SIZE-1/SIZE/SIZE+1, substring), StringHolder - Memory safety with incorrect capacity (clear/reassign/copy/insert patterns), and the FL_TEST_FILE closer.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2962: Modifies tests/fl/stl/string.cpp with overlapping StringHolder/capacity/null-terminator off-by-one boundary test coverage — the exact block this PR extracts.

Poem

🐇 Hop hop, the tests have moved today,
No logic lost along the way!
A file of its own, so clean and bright,
Off-by-one bugs caught in the night.
The null terminator rests in peace,
And string.cpp's clutter finds release! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/3131-string-memory-bugs-extract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant