Running unit tests from DUB single file packages

drug drug2004 at bk.ru
Wed Dec 23 07:47:08 UTC 2020


On 12/22/20 8:32 PM, jmh530 wrote:
> On Tuesday, 22 December 2020 at 15:06:09 UTC, drug wrote:
>> [snip]
>>>
>>> But what do you mean exactly by "work with dependency"? As I 
>>> understand, `dub test` does not run unit tests in dependencies and 
>>> single file packages work with dependencies in general. Do you mean 
>>> something else? I'm finishing the new PR to fix #2051 finally and I'd 
>>> like to know if there is something else I should include in it.
>>
>> https://github.com/dlang/dub/pull/2064
> 
> Thanks. It looks like your UT with taggedalgebraic does exactly what I 
> was looking for.
> 
> My problem is that run.dlang.org will skip unittests when you have 
> dependencies. I had made some progress on fixing this a few months ago 
> [1], but put it on the back burner when I ran into similar issues that 
> the OP was dealing with. The problem ultimately came down to dub test 
> not working with --single, which it looks like this latest PR will fix 
> for good.
> 
> [1] https://github.com/dlang-tour/core-exec/pull/56

Ah, I see. Then I would say that `dub test` doesn't run unit tests from 
the main source file (where the main function is placed). And this is 
the reason, I guess. Now `dub test` runs unit tests from the main source 
file if the package is a single file one. I think that dependencies is 
irrelevant here, at least I didn't do anything special for them. Let's 
see what happens.


More information about the Digitalmars-d-learn mailing list