Skip to content

🧪 Add unit tests for replace_all utility function - #4

Open
jnorthrup wants to merge 1 commit into
mainfrom
testing-improvement-replace-all-8825837451735440624
Open

jnorthrup wants to merge 1 commit into
mainfrom
testing-improvement-replace-all-8825837451735440624

Conversation

@jnorthrup

Copy link
Copy Markdown
Owner

I have implemented unit tests for the replace_all utility function to increase code reliability and coverage.

🎯 What

The replace_all function in source/common.h was missing dedicated unit tests despite being a core utility used in several places (like regex handling).

📊 Coverage

The new test suite in source/tests/unit_test_replace_all.cpp covers:

  • Happy Paths: Single and multiple replacements.
  • String Length Changes: Replacing with both longer and shorter strings.
  • Deletions: Using an empty replacement string.
  • Edge Cases: Empty source strings, patterns not found, and overlapping patterns.

✨ Result

The replace_all utility is now verified to behave correctly across standard and edge-case scenarios, providing a safety net for future refactoring. All tests passed successfully.


PR created automatically by Jules for task 8825837451735440624 started by @jnorthrup

Added a comprehensive suite of unit tests for the `replace_all` string utility function located in `source/common.h`.

The tests cover:
- Basic single replacement
- Multiple occurrences
- Replacement with longer/shorter strings
- Replacement with empty strings
- Patterns not found in source
- Overlapping patterns (ensuring non-recursive behavior)

Tests are located in `source/tests/unit_test_replace_all.cpp`.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant