Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 10, 2012 Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Hello all, Is there any way to specify individual Phobos modules to unittest when building, instead of having to do the whole lot? When working on 1 single module, it'd be nice to be able to unittest that one alone and not have to worry about doing the complete set of tests until ready to push back to GitHub. Can anyone advise? Thanks & best wishes, -- Joe |
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote:
> Hello all,
>
> Is there any way to specify individual Phobos modules to unittest when
> building, instead of having to do the whole lot?
>
> When working on 1 single module, it'd be nice to be able to unittest
> that one alone and not have to worry about doing the complete set of
> tests until ready to push back to GitHub.
>
> Can anyone advise?
>
> Thanks & best wishes,
>
> -- Joe
the tests are not executed at compile time but instead at runtime before main(). so you have to compile the modules seperately, and only the modules you want to test with the unittest flag.
that means:
dmd -c module1.d module2.d module3.d
dmd -c -unittest module_with_tests.d
dmd module1.o module2.d module3.o module_with_tests.o
when you run your linked program your should only get the unittests from moduel_with_tests.
regards
christian
|
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Thursday, 10 May 2012 at 16:22:11 UTC, Joseph Rushton Wakeling wrote:
> Hello all,
>
> Is there any way to specify individual Phobos modules to unittest when building, instead of having to do the whole lot?
>
> When working on 1 single module, it'd be nice to be able to unittest that one alone and not have to worry about doing the complete set of tests until ready to push back to GitHub.
>
> Can anyone advise?
>
> Thanks & best wishes,
>
> -- Joe
compile your module with an empty main (that is what the makefile does)
or
rdmd --main mymod.d -unittest
|
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 10/05/12 19:33, Jesse Phillips wrote:
> rdmd --main mymod.d -unittest
Thanks muchly. :-)
|
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 10/05/12 19:33, Jesse Phillips wrote:
> rdmd --main mymod.d -unittest
... on second thoughts, that doesn't seem to work. I tested by putting in place a guaranteed-fail unittest; no result. :-(
|
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On 10.05.2012 22:11, Joseph Rushton Wakeling wrote: > On 10/05/12 19:33, Jesse Phillips wrote: >> rdmd --main mymod.d -unittest > > ... on second thoughts, that doesn't seem to work. I tested by putting > in place a guaranteed-fail unittest; no result. :-( > mm I've been using this beast for ages with great success. rdmd --main -unittest std\regex.d may it be that -unittest should go first? -- Dmitry Olshansky |
May 10, 2012 Re: Specifying which Phobos modules to unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 10/05/12 20:47, Dmitry Olshansky wrote:
> mm I've been using this beast for ages with great success.
>
> rdmd --main -unittest std\regex.d
>
> may it be that -unittest should go first?
D'oh! Yup. :-\
|
Copyright © 1999-2021 by the D Language Foundation