I use run.dlang.io often to test things, and then when I see they are broken, I change to "all compilers" to see when it might have broken/changed.
However, there are two limits that frustrate this process:
- There is a limit to the amount of output that can be shown. If your test case spits out a bunch of text that changes from version to version (i.e. a big exception trace with differing line numbers), then it will truncate the result, potentially hiding the place where the issue lies.
- There is a limit to the time your request can take. The reasons for this are obvious.
However, I have discovered a trick to avoid these limits while still testing multiple versions. D has a __VERSION__
special token that identifies the version of the compiler. For 2.100, __VERSION__ == 2100
.
Great, how can we use this?
static if(__VERSION__ >= 2100) {
// real test code
} else void main() {}
Now, the test code only builds on versions 2.100 and above, and a quick basic program which can build and run very quickly and outputs nothing will build on prior versions.
What if the change occurred before 2.100? Simply change the range:
static if(__VERSION__ >= 2090 && __VERSION__ < 2100) {
// real test code
} else void main() {}
Basically, this avoids the limitations, and still allows you to test simple problems with a range of D versions without having to download them locally.
-Steve