Remix.run Logo
1718627440 5 hours ago

> This blog post talks as if mocking the `open` function is a good thing that people should be told how to do. If you are mocking anything in the standard library your code is probably structured poorly.

Valgrind is a mock of standard library/OS functions and I think its existence is a good thing. Simulating OOM is also only possible by mocking stuff like open.

vkou 5 hours ago | parent [-]

All rules exist to be broken in the right circumstances. But in 99.9% of test code, there's no reason to do any of that.

1718627440 4 hours ago | parent [-]

I think when testing code with an open call, it is a good idea to test what happens on different return values of open. If that is not what you intent to test for this method, then that method shouldn't contain open at all, as already pointed out by other comments.