News for hackers. Stuff that matters.
Re:How to write unit tests in C++ relying on non-code files? by MathMonkeyMan on Thursday February 22, 2024 @10:24PM (#39476594)
Yep, common use case for what I work on is BLAH_BLAH_THINGY_CONFIG_FILE in the environment being a path to some file that the library will open to read config, instead of having the config itself in the environment (maybe it's a large unwieldy JSON thing).

https://github.com/DataDog/dd-trace-cpp/blob/6dacac2922d08f4...

It's not secure, but I'm not worried about bad actors monitoring /tmp in my test container so they can make my tests fail anyway.

It would be nice if there were a "file paths that start with a null character belong to an ad hoc in memory file system specific to the process," or something. /tmp/tmp.eJaVgxtV0x/ is close enough.

Open to code golfing suggestions on the code linked above.

There are no comments on this comment yet.