How can one reliably run unittests
James Blachly
james.blachly at gmail.com
Thu Sep 9 00:13:00 UTC 2021
On 9/2/21 7:00 PM, Steven Schveighoffer wrote:
> What I was saying is, you have a library, you built it without -unittest
> (on its own build line, or just use dub because it does the right
> thing), and then you build your main application with -unittest, linking
> in the already-built library (or its object files). The runtime runs all
> unittests it finds, and so it's running just the modules that were built
> with the -unittest flag.
>
Steve:
Sorry to reply a few days late and in the middle of a gargantuan thread,
but I wanted some clarification from you on dub just doing the right
thing --
Let's suppose I maintain a library L (written in D; has unit tests).
Suppose further I have client program P, which uses L.
As far as I can tell, if P's dubfile includes library L, and the user
execeutes `dub test` then the unit tests from the library L as well as
program P are built and executed.
We had to wrap our library's unittests in `debug(library_unittest)` to
escape this behavior.
Can you provide some clarity because it sounds like you are saying dub
will build P's unit tests, but not library L's? Not at all my
experience, unless it was updated recently.
More information about the Digitalmars-d
mailing list