On Wednesday, 11 August 2021 at 09:31:46 UTC, tastyminerals wrote:
I would like to trigger tests in a simple dub project.

```
source/my_script.d
dub.json
```

Here is a dub config:
```json
{
    "targetPath": "build",
        "targetType": "executable",
        "sourcePaths": ["source"],
        "name": "my_script",
        "buildTypes": {
                "release": {
                        "buildOptions": [
                                "releaseMode",
                                "inline",
                                "optimize"
                        ]
                },
                "tests": {
                        "buildOptions": [
                                "unittests"
                        ]
                }
        }
}

```
The project builds but when I attempt to run `dub test`, I get

```
.dub/code/my_script-test-application-unittest-posix.osx.darwin-aarch64.arm_hardfloat-ldc_v1.26.0-8A5B544D5AC6B47B68DE875ACB4BA60E_dub_test_root.d(9,12):
 Error: only one `main` allowed. Previously found `main` at 
source/my_script.d(131,6)
```

How can one run tests with dub?

Hahaha, I fixed it by renaming the `my_script.d` to `app.d`. Oh boy.

Reply via email to