3 ms·
Any other ideas on how to write testable code which uses this filesystem API? not nice ones (or I must be missing something). Could either make all code take t
by stinos 12y ago
Any other ideas on how to write testable code which uses this filesystem API?
not nice ones (or I must be missing something). Could either make all code take the API as a template parameter, or wrap the API in your own set of classes. Now often the logic you really want to (unit) test isn't the one directly accessing the filesystem but rather a layer higher? And in case of integration/system tests (or whatever it's called these days) wouldn't you rather use the actual filesystem, like with the temp directory you talk about? Can you provide a concrete example of what would be hard to test with this?
- rikkus 12y agoIt's third party code I worry about, where it hasn't been written to expect a root directory. I can chroot on *NIX, I suppose. Perhaps I should go and have a look at how code using boost normally deals with dependency injection for testing. Maybe I'm missing something.