Merge pull request #10525 from 9999years/field-stanza-names
[cabal.git] / cabal-testsuite / PackageTests / SDist / Respect-Project-File / README.md
blobe400102d3a42b8d5a2065cf01fc11fd0ab826942
1 # Tests of sdist with `--project-file`
3 ```
4 $ tree -P '*.project|*.test.hs' --prune
6 ├── cabal.ignore-project.test.hs
7 ├── cabal.ignore-project.v2.test.hs
8 ├── cabal.no-project.test.hs
9 ├── cabal.no-project.v2.test.hs
10 ├── cabal.project
11 ├── Projects-Default-No
12 │   ├── cabal.dot-uv.project
13 │   ├── cabal.dot-uv.test.hs
14 │   ├── cabal.dot-uv.v2.test.hs
15 │   ├── cabal.ignore-project.test.hs
16 │   ├── cabal.ignore-project.v2.test.hs
17 │   ├── cabal.no-project.test.hs
18 │   ├── cabal.no-project.v2.test.hs
19 │   ├── cabal.sub-pq.project
20 │   ├── cabal.sub-pq.test.hs
21 │   ├── cabal.sub-pq.v2.test.hs
22 │   ├── cabal.sub-rs.project
23 │   ├── cabal.sub-rs.test.hs
24 │   └── cabal.sub-rs.v2.test.hs
25 └── Projects-Default-Yes
26     ├── cabal.dot-uv.project
27     ├── cabal.dot-uv.test.hs
28     ├── cabal.dot-uv.v2.test.hs
29     ├── cabal.ignore-project.test.hs
30     ├── cabal.ignore-project.v2.test.hs
31     ├── cabal.no-project.test.hs
32     ├── cabal.no-project.v2.test.hs
33     ├── cabal.project
34     ├── cabal.project.test.hs
35     ├── cabal.project.v2.test.hs
36     ├── cabal.sub-pq.project
37     ├── cabal.sub-pq.test.hs
38     ├── cabal.sub-pq.v2.test.hs
39     ├── cabal.sub-rs.project
40     ├── cabal.sub-rs.test.hs
41     └── cabal.sub-rs.v2.test.hs
43 3 directories, 34 files
44 ```
46 There are of the two subdirectories, one has a `cabal.project` and the other
47 doesn't. This is the default project. There are three important things to notice
48 with these tests.
50 1. All the tests with a supplied `--project-file` option pick up a default
51    `cabal.project` instead; either the one one in the current directory or the
52    one from the parent directory, one level up. I think this behaviour is wrong
53    and the supplied `--project-file` option should be respected.
55    Before I'd put a project there, one level up, the project probing had gone
56    all the way up to Cabal's own `cabal.project` as can be seen by this diff
57    after that change:
59     ```diff
60     $ git diff
61     ...
62     --- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out
63     +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out
64     @@ -1,12 +1,2 @@
65     # cabal sdist
66     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-3.11.0.0.tar.gz
67     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/cabal-testsuite-3.tar.gz
68     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-syntax-3.11.0.0.tar.gz
69     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/cabal-install-3.11.0.0.tar.gz
70     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/cabal-install-solver-3.11.0.0.tar.gz
71     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/solver-benchmarks-3.tar.gz
72     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-QuickCheck-3.11.0.0.tar.gz
73     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-tree-diff-3.11.0.0.tar.gz
74     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-described-3.11.0.0.tar.gz
75     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/Cabal-tests-3.tar.gz
76     -Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/cabal-benchmarks-3.tar.gz
77     +Wrote tarball sdist to <ROOT>/cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz
78     ```
80 2. The `--ignore-project` option works, as witnessed by each
81    `cabal.ignore-project.test.hs` when the package in the same directory as the
82    test is used.
84 3. The `*.v2.test.hs` are the same as their `*.test.hs` sibling tests but they
85    exercise the `v2-sdist` command instead of the `sdist` command.