dmd -unittest=<pattern> (same syntax as -i)

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 15 03:28:50 UTC 2018


On Thu, Mar 15, 2018 at 01:08:11AM +0000, Jonathan Marler via Digitalmars-d wrote:
> On Wednesday, 14 March 2018 at 21:22:01 UTC, Timothee Cour wrote:
> > would a PR for `dmd -unittest=<pattern> (same syntax as -i)` be
> > welcome?  wouldn't that avoid all the complicatiosn with
> > version(StdUnittest) ?  eg use case:
> > 
> > # compile with unittests just for package foo (excluding subpackage
> > foo.bar) dmd -unittest=foo -unittest=-foo.bar -i main.d
> 
> I'm in favor. If you decide to create a PR, all the match logic is in
> mars.d at the end of the file. Might want to move it to another
> module.

I'm also in favor.  Having recently migrated an old C++ project (well,
actually, more like rewriting it D, and still not complete yet), I've
increasingly felt the need to selectively compile unittests for a subset
of modules and test them separately from the others. Especially when one
of the modules involves really expensive tests (basically, it constructs
objects with data from rather large files, and almost all non-trivial
tests require rather large datasets), having -unittest compile unittests
for everything (including Phobos!) is a bit too blunt a hammer. Once the
module has been thoroughly tested, it seems excessive to have to rerun
its unittests over and over again just because I need to test another
modules that depends on that module, since -unittest doesn't let me run
only the tests for the module I'm currently working on.


T

-- 
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world. -- Anonymous


More information about the Digitalmars-d mailing list