Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 22, 2014 unit testing version statements | ||||
---|---|---|---|---|
| ||||
How do I unit test version statements without fixing version in place forever. ---------------- bool fun() { version(Version1) return true; else version(Version2) return true; else return false; } version = Version1; unittest { assert(fun()); } version = Version2; unittest { assert(fun()); } unittest { assert(!fun()); } version = None; // is there anyway to save and reset the version ---------------- |
August 22, 2014 Re: unit testing version statements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | Compile and run the tests with different version options. |
August 22, 2014 Re: unit testing version statements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Friday, 22 August 2014 at 09:33:10 UTC, Kagamin wrote:
> Compile and run the tests with different version options.
that is not an option
|
August 22, 2014 Re: unit testing version statements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On Friday, 22 August 2014 at 09:37:30 UTC, Robert burner Schadek wrote:
> On Friday, 22 August 2014 at 09:33:10 UTC, Kagamin wrote:
>> Compile and run the tests with different version options.
>
> that is not an option
Well, that's normally how it would be done. But if you need to test them all with the same build, it's probably easier if the unit tests are in separate modules, since then you can just set the version for the module without having to worry about resetting it.
- Jonathan M Davis
|
August 22, 2014 Re: unit testing version statements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On Friday, 22 August 2014 at 09:37:30 UTC, Robert burner Schadek wrote:
> On Friday, 22 August 2014 at 09:33:10 UTC, Kagamin wrote:
>> Compile and run the tests with different version options.
>
> that is not an option
This is how version feature is intentionally designed to work
|
Copyright © 1999-2021 by the D Language Foundation