Cripts: make URL::Query copyable via deep-copy of _state#13269
Cripts: make URL::Query copyable via deep-copy of _state#13269serrislew wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes cripts::Url::Query copyable by explicitly defining copy ctor/copy-assign to deep-copy the internal std::unique_ptr<State> scratch space, and re-enables move operations that would otherwise be suppressed. It adds coverage in Cripts gold tests and updates a Cripts test snippet to exercise the new copy operations.
Changes:
- Add explicit
cripts::Url::Querycopy ctor / copy-assign (deep-copy_state) and default move operations. - Add a new Cripts gold-test plugin and test run validating copy + mutation behavior of
Url::Query. - Update an existing Cripts test snippet to use the new copy ctor.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| include/cripts/Urls.hpp | Implements explicit copy/move operations for Url::Query by deep-copying _state. |
| src/cripts/tests/query_test.cc | Exercises Url::Query copy construction and logs before/after mutation. |
| tests/gold_tests/cripts/files/query_copy.cript | New Cripts plugin used by gold tests to validate copy/copy-assign behavior. |
| tests/gold_tests/cripts/cripts.test.py | Adds an origin transaction, remap, and a new curl-based gold test run for query copy behavior. |
There was a problem hiding this comment.
Looks good! On further inspection, I'm pretty sure we want the same fixes for the path URL component as well.
Note that this is technically still not a deep copy, but it's close enough for now, and this patch restore previous (pre-PIMPL) behavior. [It shares ownership with the source URL still, but that's a non-issue unless you explicitly .Flush() the copy].
|
[approve ci autest 0] |
Url::Queryholds its parsed-parameter scratch space in astd::unique_ptr<State>, which implicitly deletes the copy ctor and copy-assign. This PR defines the copy operations explicitly to deep-copy*_state, and= defaults the moves so they aren't suppressed by the user-declared copies.