Skip to content

🧪 [testing improvement] Add unit tests for MediaFile::split edge cases#287

Open
segin wants to merge 1 commit intomasterfrom
testing-mediafile-split-6764116392174667634
Open

🧪 [testing improvement] Add unit tests for MediaFile::split edge cases#287
segin wants to merge 1 commit intomasterfrom
testing-mediafile-split-6764116392174667634

Conversation

@segin
Copy link
Copy Markdown
Owner

@segin segin commented Apr 8, 2026

🎯 What: The testing gap addressed is the lack of unit tests for the simple, pure MediaFile::split utility functions.
📊 Coverage: The new tests in tests/test_mediafile_split.cpp cover basic splitting, empty strings, no delimiter present, consecutive delimiters, and the known edge case of trailing delimiters not generating an empty string. Both the new-vector and append-vector variants are covered.
Result: Increased test coverage and guaranteed robustness of string tokenization across the codebase, preventing future regressions.


PR created automatically by Jules for task 6764116392174667634 started by @segin

This change introduces comprehensive unit tests for both variants of
`MediaFile::split`. The tests cover standard comma separation,
empty strings, consecutive delimiters, and the known std::getline
quirk with trailing delimiters. The Makefile.am has also been
updated to integrate the new test into the `make check` suite.

Co-authored-by: segin <480709+segin@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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.

Copilot AI review requested due to automatic review settings April 8, 2026 23:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted unit test coverage for the MediaFile::split string tokenization helpers to prevent regressions across common and edge-case delimiter scenarios.

Changes:

  • Added a new C++ unit test executable covering MediaFile::split behaviors (empty input, missing delimiter, consecutive delimiters, trailing delimiter quirk, and append-variant).
  • Wired the new test into the Automake test build/run configuration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_mediafile_split.cpp New unit tests validating MediaFile::split edge cases and both overload variants.
tests/Makefile.am Registers test_mediafile_split in the test build/run targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Makefile.am
check_PROGRAMS += test_mediafile_split
test_mediafile_split_SOURCES = test_mediafile_split.cpp
test_mediafile_split_LDADD = $(COMMON_TEST_LIBS) $(AM_LDFLAGS)
TESTS += test_mediafile_split
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS is already set to $(check_PROGRAMS) earlier in this Makefile, so appending test_mediafile_split to TESTS will cause this executable to be run twice under make check. Drop the TESTS += test_mediafile_split line (or, if this test is meant to run without being in check_PROGRAMS, remove the check_PROGRAMS += ... instead).

Suggested change
TESTS += test_mediafile_split

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces unit tests for the MediaFile::split function by adding a new test file, tests/test_mediafile_split.cpp, and updating tests/Makefile.am to include it in the build process. A redundancy was identified in the Makefile where the new test is added to both check_PROGRAMS and TESTS, which would result in the test being executed twice during the check phase.

Comment thread tests/Makefile.am
Comment on lines +3853 to +3856
check_PROGRAMS += test_mediafile_split
test_mediafile_split_SOURCES = test_mediafile_split.cpp
test_mediafile_split_LDADD = $(COMMON_TEST_LIBS) $(AM_LDFLAGS)
TESTS += test_mediafile_split
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The explicit addition of test_mediafile_split to TESTS at line 3856 is redundant. In this Makefile.am, TESTS is already defined as $(check_PROGRAMS) at line 3815. Since test_mediafile_split is added to check_PROGRAMS at line 3853, it will be automatically included in the test suite. Listing it again in TESTS will cause the test to be executed twice during make check.

check_PROGRAMS += test_mediafile_split
test_mediafile_split_SOURCES = test_mediafile_split.cpp
test_mediafile_split_LDADD = $(COMMON_TEST_LIBS) $(AM_LDFLAGS)

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.

2 participants