| Thread overview | |||||
|---|---|---|---|---|---|
|
June 12, 2015 Tip: unittest-only artifacts should not be version(unittest) if used across modules | ||||
|---|---|---|---|---|
| ||||
Just ran into this with Phobos: https://github.com/D-Programming-Language/phobos/pull/3403 Andrei | ||||
June 12, 2015 Re: Tip: unittest-only artifacts should not be version(unittest) if used across modules | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Thu, Jun 11, 2015 at 11:09 PM, Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
> Just ran into this with Phobos: https://github.com/D-Programming-Language/phobos/pull/3403
>
If unittest-only artifacts are not constrained to just unittest builds, does this not make them open to be not unittest-only?
That is to say, if there is a method or whatever that is just for tests, without marking it 'version(unittest)' how do you ensure it is not actually used in the regular, shipped code?
Not sure best way to solve the across-module problem and still keep test code restricted to tests... maybe instead put the shared test code in its own module, and import with version(unittest).
| |||
June 14, 2015 Re: Tip: unittest-only artifacts should not be version(unittest) if used across modules | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jeremy Powers | On Friday, 12 June 2015 at 19:20:41 UTC, Jeremy Powers wrote:
> On Thu, Jun 11, 2015 at 11:09 PM, Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>
>> Just ran into this with Phobos: https://github.com/D-Programming-Language/phobos/pull/3403
>>
>
> If unittest-only artifacts are not constrained to just unittest builds, does this not make them open to be not unittest-only?
>
> That is to say, if there is a method or whatever that is just for tests, without marking it 'version(unittest)' how do you ensure it is not actually used in the regular, shipped code?
>
> Not sure best way to solve the across-module problem and still keep test code restricted to tests... maybe instead put the shared test code in its own module, and import with version(unittest).
I encountered a similar problem a few days ago and what Jeremy proposes seems the most reasonable solution for me.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply