Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I'm writing tests for some code that interacts with the filesystem, and I want to assert that it writes the expected data to disk. My problem is that some of the code I want to test includes hardco...
#1: Initial revision
Does GLib's "GTest" testing framework have any filesystem mocking functionality?
I'm writing tests for some code that interacts with the filesystem, and I want to assert that it writes the expected data to disk. My problem is that some of the code I want to test includes hardcoded paths and due to my requirements I cannot avoid these without adding test-specific code paths, which I would like to avoid. As such, it seems to me that some sort of filesystem mocking is the only way to avoid polluting the filesystem with real files and potentially also messing with user configuration—the program configures other programs on the system, like a settings app. I read through the [Testing Framework](https://docs.gtk.org/glib/testing.html) section of the GLib docs, but it doesn't mention anything about this. I also searched for "test" and scanned through [the results](https://docs.gtk.org/glib/index.html?q=test) but I couldn't find anything relevant there either. Does GLib's GTest testing framework provide any filesystem mocking functionality?
