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

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 15 15:19:48 UTC 2018


On 3/14/18 5:22 PM, 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
> 

Note, we can do a lot with just runtime options as well. The code to run 
all the unit tests could easily be changed to deal with such patterns. 
But this only affects unit test functions inside those modules, it 
doesn't affect unit tests inside template types (or version(unittest) 
statements).

We really should have a way to control both static unittest compilation 
on a modular level, and also which modules' unit tests are run at runtime.

For example, you may actually wish to enable version(unittest) for 
module foo, so you can test using a template inside foo with a type from 
bar, but you may only then want to run bar's unittest functions (where 
the template is actually instantiated and the unittest would be run).

-Steve


More information about the Digitalmars-d mailing list