On Sun, 2017-04-16 at 12:04 +0300, drug via Digitalmars-d-learn wrote: > […] > Try to add version for `integrationtest` to exclude `main` from > building > like you did with unittests version. In dub.sdl add versions > "integrationtests" for correspondence configuration and in > `source\main.d` add something like that:
I believe that dub test will set unittest, that integrationtests is not
set as a version symbol. Indeed experiments with ldc2 seem to indicate
that "else version(…)" doesn't seem to work.
> ```
> ...
> unittest {
> auto item = getValue!(Tuple!(string, string));
> assert(debianPackageNumberLessThan(item[0], item[1]),
> format("[%s,
> %s]", item[0], item[1]));
> }
>
> }
> else version(integrationtests){
> // do something here
> }
> else {
> int main(string[] args) {
> ...
> ```
> It works for me. But frankly I failed to reproduce your error - I
> have
> other one like
> ```
> ut_main.d(5,5): Error: only one main allowed. Previously found main
> at
> source/main.d(161,6)
> dmd failed with exit code 1.
> ```
> so very probably I fix wrong problem
Are you on a different platform/compiler combination and so just
getting different views on the same problem. I am on Fedora Rawhide
with ldc2 from packaging. D 2.071 I think.
I'll try Debian where I have dmd (oh that doesn't work for other
reasons as yet uninvestigated), ldc2 (same version as Fedora I believe,
so should not be different), and gdc (but I think I am using D features
not supported yet there, but I will check).
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
