digitalmars.D.learn - unit testing version statements
- Robert burner Schadek (21/21) Aug 22 2014 How do I unit test version statements without fixing version in
- Kagamin (1/1) Aug 22 2014 Compile and run the tests with different version options.
- Robert burner Schadek (2/3) Aug 22 2014 that is not an option
- Jonathan M Davis (8/11) Aug 22 2014 Well, that's normally how it would be done. But if you need to
- Dicebot (3/6) Aug 22 2014 This is how version feature is intentionally designed to work
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 ----------------
Aug 22 2014
Compile and run the tests with different version options.
Aug 22 2014
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
Aug 22 2014
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: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 DavisCompile and run the tests with different version options.that is not an option
Aug 22 2014
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:This is how version feature is intentionally designed to workCompile and run the tests with different version options.that is not an option
Aug 22 2014