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
cabal test [TARGETS] [FLAGS] runs the specified test suites (all the test suites in the current package by default), first ensuring they are up to date.
In the docs we could say that there is an implicit current package if we're in the same directory as a .cabal package description file.
the all target is always all tests of a project (for cabal test all), even if the directory of a package when another reasonable expectation is all tests in the package. What is the interaction between project and implicit current package for [TARGETS] that don't scope to a package explicitly?
when in a package directory, the package is automatically set as the target and, using Cabal-tests as the example, cabal test is the same as running cabal test Cabal-tests or cabal test Cabal-tests:tests from the root of the project. We could reasonably expect all to be set automatically if in the same directory as a project, couldn't we?
There's a note about all:exes in the docs for cabal install but no explicit mention of all:tests (or all:benchmarks). The all:ctypes target and all target are described as target forms. It would be good to document all the all use cases. We can't use this to refine a target, trying Cabal-tests:all:tests won't work.
$ cabal test Cabal-tests:all:tests
Error: [Cabal-7131]
Unknown target 'Cabal-tests:all:tests'.
The package Cabal-tests has no component 'all'.
There's interaction between exact targets and the all targets but is the interaction a "union" or an "intersection" or something else?
$ cabal test Cabal-tests:tests --dry-run
Build profile: -w ghc-9.8.2 -O1
In order, the following would be built (use -v for more details):
- Cabal-tests-3 (test:check-tests) (ephemeral targets)
- Cabal-tests-3 (test:custom-setup-tests) (ephemeral targets)
- Cabal-tests-3 (test:hackage-tests) (ephemeral targets)
- Cabal-tests-3 (test:no-thunks-test) (ephemeral targets)
- Cabal-tests-3 (test:parser-tests) (ephemeral targets)
- Cabal-tests-3 (test:rpmvercmp) (ephemeral targets)
- Cabal-tests-3 (test:unit-tests) (ephemeral targets)
$ cabal test Cabal-tests:tests all:tests --dry-run
Build profile: -w ghc-9.8.2 -O1
In order, the following would be built (use -v for more details):
- Cabal-tests-3 (test:check-tests) (ephemeral targets)
- Cabal-tests-3 (test:custom-setup-tests) (ephemeral targets)
- Cabal-tests-3 (test:hackage-tests) (ephemeral targets)
- Cabal-tests-3 (test:no-thunks-test) (ephemeral targets)
- Cabal-tests-3 (test:parser-tests) (ephemeral targets)
- Cabal-tests-3 (test:rpmvercmp) (ephemeral targets)
- Cabal-tests-3 (test:unit-tests) (ephemeral targets)
- cabal-benchmarks-3 (test:cabal-benchmarks) (ephemeral targets)
- cabal-install-3.13.0.0 (test:integration-tests2)
- cabal-install-3.13.0.0 (test:long-tests)
- cabal-install-3.13.0.0 (test:mem-use-tests)
- cabal-install-3.13.0.0 (test:unit-tests)
- cabal-install-solver-3.13.0.0 (test:unit-tests) (ephemeral targets)
- solver-benchmarks-3 (test:unit-tests) (ephemeral targets)
$ cabal test Cabal-tests:tests all:exes --dry-run
No tests to run for all the executables in the project
all: cannot be used redundantly before a package and if tried, cabal looks for an all package;
$ cabal test all:Cabal-tests:tests --dry-run
Error: [Cabal-7043]
Cannot test the package all, it is not in this project (either directly or indirectly). If you want to add it to the project then edit the cabal.project file.
I generated code snippets with;
$ git rev-parse HEAD
bccc59f78f64d8db8605380d6735e0730d8bea23
The text was updated successfully, but these errors were encountered:
I get an ambiguous target for a package named "all" too;
$ mkdir all
$ cd all
$ cabal init
...
$ cabal build all
Error: [Cabal-7132]
Ambiguous target 'all'. It could be:
:all (package *)
all:all (component)
$ cabal test all:tests
Error: [Cabal-7132]
Ambiguous target 'all:tests'. It could be:
:all:tests (package *:filter)
pkg:all:tests (package:filter)
In the docs we could say that there is an implicit current package if we're in the same directory as a
.cabal
package description file.cabal/cabal-install/tests/IntegrationTests2.hs
Lines 196 to 200 in bccc59f
We could clear up some possible gotchas;
the
all
target is always all tests of a project (forcabal test all
), even if the directory of a package when another reasonable expectation isall
tests in the package. What is the interaction between project and implicit current package for[TARGETS]
that don't scope to a package explicitly?when in a package directory, the package is automatically set as the target and, using
Cabal-tests
as the example,cabal test
is the same as runningcabal test Cabal-tests
orcabal test Cabal-tests:tests
from the root of the project. We could reasonably expectall
to be set automatically if in the same directory as a project, couldn't we?There's a note about
all:exes
in the docs forcabal install
but no explicit mention ofall:tests
(orall:benchmarks
). Theall:ctypes
target andall
target are described as target forms. It would be good to document all theall
use cases. We can't use this to refine a target, tryingCabal-tests:all:tests
won't work.all
targets but is the interaction a "union" or an "intersection" or something else?all:
cannot be used redundantly before a package and if tried, cabal looks for anall
package;I generated code snippets with;
The text was updated successfully, but these errors were encountered: