Re:How to write unit tests in C++ relying on non-code files?
by gpderetta on Friday February 23, 2024 @07:43AM
(#39479846)
Refactoring so that the class gets an istream or some other abstraction would be better, but when you can't change the code easily, "/dev/fd/<n>" can be an option on Linux and some other unices.
I have also seen horrific but effective test harness code that override open/close/read/write from libc.
I have also seen horrific but effective test harness code that override open/close/read/write from libc.