feat: add read(), write(), and append() helper methods#209
Open
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Open
feat: add read(), write(), and append() helper methods#209Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Conversation
Convenience methods to read/modify mocked file contents without going through the tied filehandle layer. read() supports scalar (slurp) and list (line-split respecting $/) contexts. write() and append() update mtime/ctime and return $self for chaining. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
356d85e to
e80e426
Compare
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 three convenience methods to
Test::MockFileobjects for directly manipulating mocked file contents (#111):read()— returns file contents. Scalar context slurps; list context splits into lines respecting$/write(@args)— sets contents (concatenates args), updates mtime/ctime, returns$selffor chainingappend(@args)— appends to contents, creates file if non-existent, returns$selffor chainingAll three die on directories and symlinks. write/append bring non-existent files into existence.
Closes #111
Test plan
t/read_write_helpers.t🤖 Generated with Claude Code