16.04.2017 11:20, Russel Winder via Digitalmars-d-learn пишет:
There are points when you need to ask someone for help…

I am trying to get Dub to build integration tests from test-source as a
separate thing from building unit tests from source. The latter is easy
and works, as does building the application. I cannot however get the
integration tests to build, I always get something along the lines of:

../../../../../../../tmp/dub_test_root-677ee80a-1e29-44c8-b08c-2fe37eb83633.d(10,12):
 Error: function D main conflicts with static import dub_test_root.main at 
../../../../../../../tmp/dub_test_root-677ee80a-1e29-44c8-b08c-2fe37eb83633.d(3,15)

and I haven't a clue. This is almost certainly just a bad dub.sdl file,
but, if anyone can take a look at tell me what I am failing to get
right, I'd appreciate it.

https://github.com/russel/ApproxGC


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:
```
...
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

Reply via email to