You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Passing arguments to test suites run via new-test is unsupported #4643
Currently it is impossible to pass any arguments to a test suite that is run via new-test since they are interpreted as targets (regardless of how many -- you add in between).
There is the question of what should happen if multiple test suites are run. Personally, I would prefer if the arguments are just passed to all of them in that case but I’m also fine with an error or whatever else as long as I have the possibility to specify the test suite explicitly.
Reacted by Dmitrii Kovanikov, David Feuer and Nicolas Audinet de Pieuchon
Let me offer one more unsolicited suggestion: maybe cabal new-test should NOT support running multiple tests. If you want multiple tests, make a new command or something.
I somewhat sympathize with @ezyang's suggestion; it would probably make things simpler and less surprising. However, we still want the ability to say cabal new-test all or cabal new-test :pkg:cabal-install. Maybe just disallow running multiple tests and passing flags at the same time; or expressed dually: allow flags only when the target resolves to a single test program?
@l29ah unfortunately, this is correct. The corresponding issue is #6198. There's a draft PR attached to it (#7454) with a simple and straightforward design, but it's abandoned, as far as I can see. Do you want to try to pull it out? We're happy to advise.
Activity
fgaz commentedon Jul 29, 2017
This probably also affects
new-bench23Skidoo commentedon Jul 29, 2017
Just bumped into this the other day. I think that none of the flags specific to old-test (
TestFlags) are supported by new-test right now.fgaz commentedon Jul 29, 2017
Apparently some are set to
mempty.See
setupHsTestFlagsandsetupHsTestArgsinDistribution/Client/ProjectPlanning.hslspitzner commentedon Aug 3, 2017
in the meantime..
which probably is brittle and breaks if you build tests with and without optimizations at some point..
hvr commentedon Aug 3, 2017
@lspitzner less brittle: use
cabal-plan list-bin:-)fgaz commentedon Aug 10, 2017
Continuing on #3638 (comment),
That's because @hvr's example uses (currently) incorrect syntax.
As with
new-run, the full syntax seems to be:The first
--separates cabal flags and targets, and the second one separates targets and targets' args.This correctly parses as
Edit: well, maybe the current syntax wasn't intended to be used like this?
ezyang commentedon Aug 13, 2017
Let me offer one more unsolicited suggestion: maybe
cabal new-testshould NOT support running multiple tests. If you want multiple tests, make a new command or something.hvr commentedon Aug 13, 2017
I somewhat sympathize with @ezyang's suggestion; it would probably make things simpler and less surprising. However, we still want the ability to say
cabal new-test allorcabal new-test :pkg:cabal-install. Maybe just disallow running multiple tests and passing flags at the same time; or expressed dually: allow flags only when the target resolves to a single test program?phadej commentedon Aug 13, 2017
Yes, there should be a way to run all tests (in project/package) without knowing the test-suite names.
fgaz commentedon Jan 17, 2018
Partially fixed with #4861 (new-run can now run tests/benchs and it can pass arguments).
new-test still cannot pass arguments.
sjakobi commentedon Jul 19, 2018
I'd love to see a fix for this! I think the
new-runworkaround doesn't work for me because it doesn't support--allow-newer.Port 'TestFlags' to 'new-test' (#5455)
l29ah commentedon Sep 30, 2022
new-testandnew-benchstill don't accept args via--, as seen with cabal-3.6.2.0ulysses4ever commentedon Sep 30, 2022
@l29ah unfortunately, this is correct. The corresponding issue is #6198. There's a draft PR attached to it (#7454) with a simple and straightforward design, but it's abandoned, as far as I can see. Do you want to try to pull it out? We're happy to advise.