Skip to content

fix: test: add unit tests for string/path utility edge cases - #117

Open
VedantMadane wants to merge 1 commit into
cosmo-wander-ai:mainfrom
VedantMadane:fix/issue-20
Open

fix: test: add unit tests for string/path utility edge cases#117
VedantMadane wants to merge 1 commit into
cosmo-wander-ai:mainfrom
VedantMadane:fix/issue-20

Conversation

@VedantMadane

@VedantMadane VedantMadane commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Add Catch2 unit tests for string/path utility edge cases.

Changes

  • test/test_string_util.cc — consecutive/leading delimiters, trailing separators, compound extensions, backslash behavior, JoinStrings/Trim edges
  • test/test_path_util.cc — IsSafePathComponent length/control-byte edges; IsWithinRoot empty/repeated-separator edges

Fixes #20

@Fernandez81 Fernandez81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution. This change does not currently satisfy #20 and cannot be merged as-is:

  1. pathUtil.edge.test.js imports packet_stringifier.go as an ES module. Node rejects the .go extension with ERR_UNKNOWN_FILE_EXTENSION.
  2. That vendored Pion RTCP file contains Go packet-stringification code and does not export normalizeSlashes, isAbsolutePath, or joinPath. As a result, these tests do not exercise any CosmoEdge string/path utility.
  3. The first normalization assertion is too permissive: an unchanged value such as a\\b still contains a, so incorrect behavior would pass. The standalone test:edge script is also not part of the C++ test target or any CI command.

Please remove the top-level JavaScript test and the root package.json script. Add focused Catch2 cases to the existing test/test_string_util.cc, test/test_path_util.cc, and/or test/test_file_util.cc, using exact expected results from the actual CosmoEdge implementations. Then validate with the repository-supported Docker flow for scripts/build_cpu_test.sh and build_cpu/cosmo-tests.

Extend Catch2 coverage in test_string_util.cc and test_path_util.cc for empty input, consecutive/leading delimiters, trailing separators, compound extensions, and platform path-separator edge cases.

Fixes cosmo-wander-ai#20

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
@VedantMadane VedantMadane reopened this Aug 24, 2026
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.

test: add unit tests for string/path utility edge cases

2 participants