Skip to content

Commit 907916b

Browse files
philderbeastmergify[bot]
authored andcommitted
Add verbatim *.expect.txt expectations
- Add oops.expect.txt - Add cabal-missing-package.expect.txt - Add hops.expect.txt - Add DedupUsingConfigFromComplex/errors.expect.txt - Add using configuration from to errors.expect.txt (cherry picked from commit 32b820b)
1 parent 1a4350a commit 907916b

File tree

6 files changed

+110
-117
lines changed

6 files changed

+110
-117
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
When using configuration from:
2+
- cabal-missing-package.project
3+
- missing/pkgs.config
4+
- missing/pkgs/default.config
5+
The following errors occurred:
6+
- The package location 'pkg-doesnt-exist' does not exist.

cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs

Lines changed: 8 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Test.Cabal.Prelude
22
import Test.Cabal.OutputNormalizer
33
import Data.Function ((&))
4+
import Data.Functor ((<&>))
45

56
main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
67
let log = recordHeader . pure
@@ -78,7 +79,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
7879
-- +-- etc
7980
log "checking that cyclical check catches a same file name that imports itself"
8081
cyclical4a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-self.project" ]
81-
assertOutputContains (normalizeWindowsOutput "cyclical import of same-filename/cyclical-same-filename-out-out-self.config") cyclical4a
82+
assertOutputContains (normalizePathSeparators "cyclical import of same-filename/cyclical-same-filename-out-out-self.config") cyclical4a
8283

8384
-- +-- cyclical-same-filename-out-out-backback.project
8485
-- +-- cyclical-same-filename-out-out-backback.config
@@ -111,64 +112,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
111112
log "checking that imports work skipping into a subfolder and then back out again and again"
112113
hopping <- cabal' "v2-build" [ "--project-file=hops-0.project" ]
113114

114-
"Configuration is affected by the following files:\n\
115-
\- hops-0.project\n\
116-
\- hops-2.config\n\
117-
\ imported by: hops/hops-1.config\n\
118-
\ imported by: hops-0.project\n\
119-
\- hops-4.config\n\
120-
\ imported by: hops/hops-3.config\n\
121-
\ imported by: hops-2.config\n\
122-
\ imported by: hops/hops-1.config\n\
123-
\ imported by: hops-0.project\n\
124-
\- hops-6.config\n\
125-
\ imported by: hops/hops-5.config\n\
126-
\ imported by: hops-4.config\n\
127-
\ imported by: hops/hops-3.config\n\
128-
\ imported by: hops-2.config\n\
129-
\ imported by: hops/hops-1.config\n\
130-
\ imported by: hops-0.project\n\
131-
\- hops-8.config\n\
132-
\ imported by: hops/hops-7.config\n\
133-
\ imported by: hops-6.config\n\
134-
\ imported by: hops/hops-5.config\n\
135-
\ imported by: hops-4.config\n\
136-
\ imported by: hops/hops-3.config\n\
137-
\ imported by: hops-2.config\n\
138-
\ imported by: hops/hops-1.config\n\
139-
\ imported by: hops-0.project\n\
140-
\- hops/hops-1.config\n\
141-
\ imported by: hops-0.project\n\
142-
\- hops/hops-3.config\n\
143-
\ imported by: hops-2.config\n\
144-
\ imported by: hops/hops-1.config\n\
145-
\ imported by: hops-0.project\n\
146-
\- hops/hops-5.config\n\
147-
\ imported by: hops-4.config\n\
148-
\ imported by: hops/hops-3.config\n\
149-
\ imported by: hops-2.config\n\
150-
\ imported by: hops/hops-1.config\n\
151-
\ imported by: hops-0.project\n\
152-
\- hops/hops-7.config\n\
153-
\ imported by: hops-6.config\n\
154-
\ imported by: hops/hops-5.config\n\
155-
\ imported by: hops-4.config\n\
156-
\ imported by: hops/hops-3.config\n\
157-
\ imported by: hops-2.config\n\
158-
\ imported by: hops/hops-1.config\n\
159-
\ imported by: hops-0.project\n\
160-
\- hops/hops-9.config\n\
161-
\ imported by: hops-8.config\n\
162-
\ imported by: hops/hops-7.config\n\
163-
\ imported by: hops-6.config\n\
164-
\ imported by: hops/hops-5.config\n\
165-
\ imported by: hops-4.config\n\
166-
\ imported by: hops/hops-3.config\n\
167-
\ imported by: hops-2.config\n\
168-
\ imported by: hops/hops-1.config\n\
169-
\ imported by: hops-0.project"
170-
& normalizeWindowsOutput
171-
& flip (assertOn multilineNeedleHaystack) hopping
115+
readFileVerbatim "hops.expect.txt" >>=
116+
flip (assertOn multilineNeedleHaystack) hopping . normalizePathSeparators
172117

173118
-- The project is named oops as it is like hops but has conflicting constraints.
174119
-- +-- oops-0.project
@@ -184,24 +129,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
184129
log "checking conflicting constraints skipping into a subfolder and then back out again and again"
185130
oopsing <- fails $ cabal' "v2-build" [ "all", "--project-file=oops-0.project" ]
186131

187-
"Could not resolve dependencies:\n\
188-
\[__0] trying: oops-0.1 (user goal)\n\
189-
\[__1] next goal: hashable (dependency of oops)\n\
190-
\[__1] rejecting: hashable-1.4.3.0\n\
191-
\ (constraint from oops/oops-9.config requires ==1.4.2.0)\n\
192-
\ imported by: oops-8.config\n\
193-
\ imported by: oops/oops-7.config\n\
194-
\ imported by: oops-6.config\n\
195-
\ imported by: oops/oops-5.config\n\
196-
\ imported by: oops-4.config\n\
197-
\ imported by: oops/oops-3.config\n\
198-
\ imported by: oops-2.config\n\
199-
\ imported by: oops/oops-1.config\n\
200-
\ imported by: oops-0.project\n\
201-
\[__1] rejecting: hashable-1.4.2.0\n\
202-
\ (constraint from oops-0.project requires ==1.4.3.0)"
203-
& normalizeWindowsOutput
204-
& flip (assertOn multilineNeedleHaystack) oopsing
132+
readFileVerbatim "oops.expect.txt"
133+
>>= flip (assertOn multilineNeedleHaystack) oopsing . normalizePathSeparators
205134

206135
log "checking bad conditional"
207136
badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ]
@@ -210,13 +139,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
210139
log "checking that missing package message lists configuration provenance"
211140
missing <- fails $ cabal' "v2-build" [ "--project-file=cabal-missing-package.project" ]
212141

213-
"When using configuration from:\n\
214-
\ - cabal-missing-package.project\n\
215-
\ - missing/pkgs.config\n\
216-
\ - missing/pkgs/default.config\n\
217-
\The following errors occurred:\n\
218-
\ - The package location 'pkg-doesnt-exist' does not exist."
219-
& normalizeWindowsOutput
220-
& flip (assertOn multilineNeedleHaystack) missing
142+
readFileVerbatim "cabal-missing-package.expect.txt"
143+
>>= flip (assertOn multilineNeedleHaystack) missing . normalizePathSeparators
221144

222145
return ()
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Configuration is affected by the following files:
2+
- hops-0.project
3+
- hops-2.config
4+
imported by: hops/hops-1.config
5+
imported by: hops-0.project
6+
- hops-4.config
7+
imported by: hops/hops-3.config
8+
imported by: hops-2.config
9+
imported by: hops/hops-1.config
10+
imported by: hops-0.project
11+
- hops-6.config
12+
imported by: hops/hops-5.config
13+
imported by: hops-4.config
14+
imported by: hops/hops-3.config
15+
imported by: hops-2.config
16+
imported by: hops/hops-1.config
17+
imported by: hops-0.project
18+
- hops-8.config
19+
imported by: hops/hops-7.config
20+
imported by: hops-6.config
21+
imported by: hops/hops-5.config
22+
imported by: hops-4.config
23+
imported by: hops/hops-3.config
24+
imported by: hops-2.config
25+
imported by: hops/hops-1.config
26+
imported by: hops-0.project
27+
- hops/hops-1.config
28+
imported by: hops-0.project
29+
- hops/hops-3.config
30+
imported by: hops-2.config
31+
imported by: hops/hops-1.config
32+
imported by: hops-0.project
33+
- hops/hops-5.config
34+
imported by: hops-4.config
35+
imported by: hops/hops-3.config
36+
imported by: hops-2.config
37+
imported by: hops/hops-1.config
38+
imported by: hops-0.project
39+
- hops/hops-7.config
40+
imported by: hops-6.config
41+
imported by: hops/hops-5.config
42+
imported by: hops-4.config
43+
imported by: hops/hops-3.config
44+
imported by: hops-2.config
45+
imported by: hops/hops-1.config
46+
imported by: hops-0.project
47+
- hops/hops-9.config
48+
imported by: hops-8.config
49+
imported by: hops/hops-7.config
50+
imported by: hops-6.config
51+
imported by: hops/hops-5.config
52+
imported by: hops-4.config
53+
imported by: hops/hops-3.config
54+
imported by: hops-2.config
55+
imported by: hops/hops-1.config
56+
imported by: hops-0.project
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Could not resolve dependencies:
2+
[__0] trying: oops-0.1 (user goal)
3+
[__1] next goal: hashable (dependency of oops)
4+
[__1] rejecting: hashable-1.4.3.0
5+
(constraint from oops/oops-9.config requires ==1.4.2.0)
6+
imported by: oops-8.config
7+
imported by: oops/oops-7.config
8+
imported by: oops-6.config
9+
imported by: oops/oops-5.config
10+
imported by: oops-4.config
11+
imported by: oops/oops-3.config
12+
imported by: oops-2.config
13+
imported by: oops/oops-1.config
14+
imported by: oops-0.project
15+
[__1] rejecting: hashable-1.4.2.0
16+
(constraint from oops-0.project requires ==1.4.3.0)

cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,13 @@ import Data.Function ((&))
44
main = cabalTest . recordMode RecordMarked $ do
55
let log = recordHeader . pure
66

7-
log "checking \"using config from message\" with URI imports"
7+
log "check \"using config from message\" with URI imports"
88
out <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=no-pkgs.project" ]
99

10-
-- Use assertRegex when the output is tainted by the temp directory, like
11-
-- this:
12-
--
13-
-- When using configuration from:
14-
-- - /tmp/cabal-testsuite-282695/cabal.project
15-
-- - /tmp/cabal-testsuite-282695/2.config etc
16-
assertRegex
17-
"Project configuration with URI imports is listed in full"
18-
"When using configuration from:(\n|\r\n) \
19-
\ .*no-pkgs\\.project(\n|\r\n) \
20-
\ .*0\\.config(\n|\r\n) \
21-
\ .*2\\.config(\n|\r\n) \
22-
\ .*4\\.config(\n|\r\n) \
23-
\ .*6\\.config(\n|\r\n) \
24-
\ .*8\\.config(\n|\r\n) \
25-
\ .*1\\.config(\n|\r\n) \
26-
\ .*3\\.config(\n|\r\n) \
27-
\ .*5\\.config(\n|\r\n) \
28-
\ .*7\\.config(\n|\r\n) \
29-
\ .*9\\.config(\n|\r\n) \
30-
\ .*with-ghc\\.config(\n|\r\n) \
31-
\ .*https://www.stackage.org/lts-21.25/cabal.config(\n|\r\n)"
32-
out
10+
log "check project configuration with URI imports is listed in full and"
11+
log "check package directories and locations are reported in order"
3312

34-
log "checking that package directories and locations are reported in order"
35-
36-
"The following errors occurred:\n\
37-
\ - The package directory 'no-pkg-1' does not contain any .cabal file.\n\
38-
\ - The package location 'no-pkg-2-dir' does not exist.\n\
39-
\ - The package directory 'no-pkg-3' does not contain any .cabal file.\n\
40-
\ - The package location 'no-pkg-4-dir' does not exist."
41-
& flip (assertOn multilineNeedleHaystack) out
13+
readFileVerbatim "errors.expect.txt"
14+
>>= flip (assertOn multilineNeedleHaystack) out . normalizePathSeparators
4215

4316
return ()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
When using configuration from:
2+
- no-pkgs.project
3+
- 0.config
4+
- 2.config
5+
- 4.config
6+
- 6.config
7+
- 8.config
8+
- cfg/1.config
9+
- cfg/3.config
10+
- cfg/5.config
11+
- cfg/7.config
12+
- cfg/9.config
13+
- with-ghc.config
14+
- https://www.stackage.org/lts-21.25/cabal.config
15+
The following errors occurred:
16+
- The package directory 'no-pkg-1' does not contain any .cabal file.
17+
- The package location 'no-pkg-2-dir' does not exist.
18+
- The package directory 'no-pkg-3' does not contain any .cabal file.
19+
- The package location 'no-pkg-4-dir' does not exist.

0 commit comments

Comments
 (0)