> fusefs tests. Absolutely impossible to do in C. I considered Rust, but went with C++ so they could live in base. They are too closely coupled to fusefs(5) to live out-of-tree.
Can anyone comment on why this is impossible in C?
"Impossible" is mild hyperbole. Googletest makes it relatively easy to structure complicated mocked tests in a way that is verbose but not impossible in C.
Not impossible, but a big pain. vtables can be done by hand, but C++ does that for you. I don't know rust or the problem they are talking about, but I believe something like that.
> I don't think anybody has claimed this yet. But I _have_ made a similar claim, that some things can't be written in C. I'll elaborate on the project that started this thread: the fusefs test suite. When I designed the fusefs test
suite, I based it around the priniciple of Mocking. Each test case has a client thread that does normal file system access, and a server thread that implements a fuse file server. But it isn't a full implementation of a fuse file server; it's just a shim around a mock object. For each test case, the file server's behavior is programmed with expectations. The mocking technique is so limited and awkward to use in C that almost nobody bothers. Just compare the documentation for CMockery (C) with Mockall (Rust). C++'s Googlemock is somewhere in between.
Mocking is a horrible principle. It is probably the worst of the various types of test doubles, in terms of the kind of test design they imply. Software engineering would be significantly better off, IMO, if mocking were so awkward that no one bothers to do it, ever, in any language.
I don't fully agree but what I will say is that I perceive mocking to be not that easy or good in Rust, so it is surprising to me to see it cited positively.
Can anyone comment on why this is impossible in C?