Add two test cases to unit_test_web_server.cpp#160
Open
kyriesk wants to merge 2 commits into
Open
Conversation
222448082Ashen
approved these changes
May 8, 2026
222448082Ashen
left a comment
There was a problem hiding this comment.
General Information
- Type of Change: New feature (Testing expansion) / Refactor
Code Quality
- Repository: Correct. The PR is made to
splashkit-core. - Readability: Issue identified with indentation. The PR changes the indentation style from the project-standard 4 spaces to 3 spaces. This creates inconsistency with other unit test files (e.g.,
unit_test_geometry.cpp) and the rest of thecoresdk. - Maintainability: High. The added test cases for edge scenarios (multiple slashes, percent encoding, query vs. fragment) make it much easier to maintain and verify changes to URI parsing in the future.
Functionality
- Correctness: The new tests accurately reflect how URI segments should be parsed. Specifically, handling consecutive slashes as empty stubs (
//->"") and correctly stripping query parameters while preserving fragments where appropriate is vital for routing. - Impact on Existing Functionality: No negative impact on library code.
Testing
- Test Coverage: Significant improvement. The PR moves beyond basic success cases and covers complex URI structures that are likely to be encountered in real-world web applications.
- Test Results: Logic check confirms the expected outputs align with standard URI parsing expectations.
Documentation
- Documentation: Excellent addition of comments detailing why certain tests are currently omitted (requiring a running server) and outlining future candidates for testing.
Pull Request Details
- Checklist Completion: All relevant items reviewed.
Recommendations & Observations
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enhances the web server unit tests by adding comprehensive edge case coverage to
unit_test_web_server.cpp. The investigation analyzed both interactive tests (test_web_server.cpp,test_web_service.cpp) to determine what could be adapted to automated unit tests.Investigation findings:
http_requestis an opaque handle that can only be created by a running web serversplit_uri_stubs()are pure functions that work perfectly as unit testsChanges made:
split uri stubs edge casestest case with 7 sections covering trailing slashes, consecutive slashes, nested paths, numeric segments, query strings, fragments, percent-encoded characters, and empty segmentsrequest uri parsingtest case with 3 sections testing path extraction, root path handling, and segment order preservationFixes #(none - enhancement)
Type of change
How Has This Been Tested?
All tests were run and verified to pass:
Results: All tests passed (31 assertions in 3 test cases)
Testing Checklist
Checklist