test: pin Uri port and path edge-case behavior - #61
Merged
Conversation
Uri.parse currently drops a leading zero on the port when reserializing (port is stored as Int?, so "007" round-trips as "7") and preserves raw non-grammar characters like spaces, angle brackets, and curly braces verbatim in the path, per RFC 3986 Appendix B's non-validating-recognizer posture. Both are intentional, but neither had a regression test, so a future change could silently alter either behavior. Add tests pinning both. Also tighten the RFC 3987 row in the README standards table: kuri does a one-way IRI-to-URI mapping, not full IRI validation (no bidi or repertoire checks), and the table wording was overstating the scope.
Round out the angle-bracket and curly-brace path pinning tests with the same uriString round-trip assertion the space test already has, and shrink the oversized RFC 3987 table cell back to the sibling rows' width, moving the IRI-mapping caveat into a footnote below the table.
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.
Summary
Uri.parsedrops a leading zero on the port when reserializing (http://h:007/round-trips ashttp://h:7/, since port is stored asInt?).<,{/}) in the path are preserved verbatim rather than rejected or percent-encoded, per theUriprofile's RFC 3986 Appendix B non-validating-recognizer behavior.Irimapping (RFC 3987 §3.1/§3.2), not a validating parser (no §4 bidi or repertoire checks).Test plan
./gradlew :kuri:jvmTest :kuri:ktlintCheck :kuri:detekt :kuri:apiCheck— all four pass (BUILD SUCCESSFUL)