News for hackers. Stuff that matters.
Re:How to write unit tests in C++ relying on non-code files? by minighost on Friday February 23, 2024 @02:02AM (#39477756)
A function that both opens a file and does something with its contents should be refactored. It’s painful to find code like this and happen to have a string or pointer to some buffer that already contains the data that needs to be converted but the conversion function is buried inside a function that tries to open a file. Go’s io.Reader is so elegant at this.

There are no comments on this comment yet.