feat: add rename() override for mocked files#212
Closed
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Closed
feat: add rename() override for mocked files#212Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Conversation
Implements CORE::GLOBAL::rename to handle mocked file renames: - Mocked source moves to new path, preserving content - Overwrites existing mocked destination (matching real behavior) - Error handling: ENOENT, EISDIR, ENOTDIR, ENOTEMPTY, EXDEV - Symlink entries rename without following (correct rename semantics) - Same-path rename is a safe no-op - Unmocked files pass through to CORE::rename Includes comprehensive test suite (t/rename.t) covering all scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
03d28e4 to
527f9dd
Compare
Contributor
Author
|
Superseded by #222 which includes both the rename override and the autovivify feature. |
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
Adds
CORE::GLOBAL::renameoverride so thatrename()works correctly on mocked files.Currently, calling
rename()on a mocked file bypasses the mock layer entirely and hits the real filesystem, which is both confusing and potentially destructive in tests.Changes
__rename($$)function following existing override patternsfile_arg_position_for_commandandBEGINblockEXDEVandENOTEMPTYtoErrnoimportsBehavior
CORE::renameEISDIRENOTDIRENOTEMPTYEXDEVENOENTTests
New
t/rename.twith 10 subtests covering all scenarios above.🤖 Generated with Claude Code