haskell / haskell/cabal

cabal v2-test does not respect `--`

Open
#6,198 9 comments 4 reactions 1 assignee Claimed by @ptkato View on GitHub
cabal-install: cmd/test type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

Passing additional arguments to the test suite with `cabal new-test` / `v2-test` seems impossible.

**To Reproduce**

1. Create a cabal project with a (trivial) test suite with `type: exitcode-stdio-1.0`.
2. Run `cabal v2-test -- --foo`.

**Expected behavior**

The `--foo` argument is passed to the compiled test suite.

**Observed behavior**

Cabal fails with an error message:

```
cabal: Unknown target '--foo'.
There is no component '--foo'.
The project has no package '--foo'.
```

**System informataion**
- Debian 9, x64
- `cabal`: 2.4.1.0
- `ghc`: `The Glorious Glasgow Haskell Compilation System, version 8.6.5`

**Additional context**

Note that `cabal v2-test --help` has the following to say on the matter of passing arguments to test suites:

```
To pass command-line arguments to a test suite, see the v2-run command.
```

Which, in turn, suggests using `--`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.