selective tests

Dennis dkorpel at gmail.com
Sat Oct 12 11:13:06 UTC 2019


On Saturday, 12 October 2019 at 09:52:59 UTC, Jonathan M Davis 
wrote:
> You could set up your build so that you had targets which only 
> compiled specific directories so that the only unit tests that 
> were run were the ones in those directories, but I don't think 
> that it's possible to do anything like that with dub. 
> Certainly, if it is, it would be a royal pain to set up.

I think you can do it with sub packages:

dub.sdl
```
name "bread-and-butter"
description "the best thing since slided bread"
sourceFiles ""
dependency "bread-and-butter:bread"  version="*"
dependency "bread-and-butter:butter" version="*"

subPackage {
     name "bread"
     sourceFiles "source/bread/*.d"

}

subPackage {
     name "butter"
     sourcePaths "source/butter"
     dependency "bread-and-butter:bread" version="*"
}
```

Then you can run tests like:

```
dub test bread-and-butter
dub test bread-and-butter:bread
dub test bread-and-butter:butter
```

An annoying thing about sub packages though is that you may have 
to duplicate lots of settings.
(hint hint 
https://forum.dlang.org/thread/fppszpfvbnvioeiakfjv@forum.dlang.org)


More information about the Digitalmars-d-learn mailing list