April 04, 2023 How do you work with unittest libraries in dub packages? | ||||
---|---|---|---|---|
| ||||
Recently Dmytro Katyukha brought up an issue in one of my dub packages that is supposed to be used as a library. He even went the whole way and came up with a simple reduced example: https://gitlab.com/gizmomogwai/colored/-/merge_requests/3#note_1341026928. The problem here is, that my dub package uses unit_threaded in the unittest configuration, and only imports unit_threaded in a `version (unittest)` block. Previously I imported unit_threaded only in the individual testfunctions themselves, but I thought to reduce some typing. When my library is now used in another project (that does not depend on unit_threaded) `dub test` seems to still compile my library with the unittest version, but it would not run the unittests of my library. So in the end `dub test` fails for the dependent project (as it is not providing unit_threaded). Is this behavior expected? What would be best practice to work around that? Kind regards, Christian |
Copyright © 1999-2021 by the D Language Foundation