Skip to content

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.

3 participants