Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MockFile - clone the bytes in read/write allbytes methods #856

Merged
merged 4 commits into from
Jun 9, 2022
Merged

fix: MockFile - clone the bytes in read/write allbytes methods #856

merged 4 commits into from
Jun 9, 2022

Conversation

jamesmoore
Copy link
Contributor

What is this doing?

  • When reading from the MockFile's content with the ReadAllBytes method return a copy of the content, not a reference to the content itself.
  • When writing to the MockFile content update it with a copy of the new content, not a reference to the new content.

Why are we doing this?

These Read/WriteAllBytes should be result in two instances of the file content - one on the mock filesystem and the in-memory instance.

How was it tested?

Unit tests to ensure there are two independent instances of the content after each operation.

@jamesmoore jamesmoore changed the title MockFile - clone the bytes in read/write allbytes methods fix: MockFile - clone the bytes in read/write allbytes methods May 28, 2022
Copy link
Contributor

@siprbaum siprbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@fgreinacher fgreinacher merged commit de8dd8e into TestableIO:main Jun 9, 2022
@fgreinacher
Copy link
Contributor

Thanks @jamesmoore 👍

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

This is addressed in release v17.0.18.

@github-actions github-actions bot added the state: released Issues that are released label Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: released Issues that are released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants