Disable unittest execution of third-party code
I'm trying to figure out how to use the "-unittest" dmd switch to select which files unittests are executing.
I have an "ad" file containing a unittest block. The "ad" file is imported from a third party module (requires the "b1.d" file and, in turn, "b2.d"), which contains its own unittest blocks.
I don't want to run tests in third party code: I just want to run tests in ad
If I compile third party code first
dmd -c b1.d b2.d
then try to link it to my code using unittests copied to
dmd -unittest a.d b1.o b2.o
then I get a message that the module in b1.d that ad is trying to import is in a file that cannot be read.
Can anyone show me how to do this?
Thank!
source to share
What you want to do is impossible, because the ad imported b1.d and b2.d . This means that these modules must be passed to the compiler.
If you want to link multiple *. o , this is more complicated: you need to write an interface (* .di file for them, as for *. so ), so it is not recommended to use this mechanism to bypass unittests. (although it might work a little hard).
An easier way to randomly select some unittests is to use the getUnitTests trait . This is really more of the way to go.
source to share