Introduce a basic 'unittest' framework#2603
Conversation
s-ludwig
left a comment
There was a problem hiding this comment.
I didn't look through the individual tests, yet, but I'm in favor of this approach. We switched to a similar scheme internally some years ago, albeit without relying on fork, but rather by having a small shell script foreach over each test (calling the test binary without arguments lists all test identifiers, calling it with an argument will run the test matching the given identifier).
So AFAICS, the main open question is Windows support. It looks like we'd have to somehow compile in Posix mode for Cygwin to make the fork approach work? An alternative would be to let the main test invoke itself using std.process.execute and the command line argument approach. That way we would still stay in D land, without the need for a shell script loop.
source/dub/test/base.d
Outdated
| public ~this () | ||
| { | ||
| // destroy dir | ||
| //std.file.rmdirRecurse(this.dir); |
The intent is to progressively evolve to a pure unittest framework, removing any filesystem dependency. While the approach introduced here is not ideal, it makes tests much easier to write, run, and provided the framework is ported to Windows, opens up the possibility of running them on Windows.
431d22f to
09deb72
Compare
|
I have a better alternative: #2759 |
Writting tests for dub is quite convoluted, so this is an attempt at simplifying the process. Feedback welcome.