Take a look at the D test suite, such as: https://github.com/dlang/dmd/blob/master/test/runnable/test42.d Each of these tests cases started out as some long complicated thing that got reduced to a very small self-contained test case.