1
1
import Test.Cabal.Prelude
2
-
3
- normalizeWindowsOutput :: String -> String
4
- normalizeWindowsOutput = if isWindows then map (\ x -> case x of ' /' -> ' \\ ' ; _ -> x) else id
2
+ import Test.Cabal.OutputNormalizer
3
+ import Data.Function ((&) )
5
4
6
5
main = cabalTest . withRepo " repo" . recordMode RecordMarked $ do
7
6
let log = recordHeader . pure
@@ -111,89 +110,65 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
111
110
-- +-- hops/hops-9.config (no further imports so not cyclical)
112
111
log " checking that imports work skipping into a subfolder and then back out again and again"
113
112
hopping <- cabal' " v2-build" [ " --project-file=hops-0.project" ]
114
- assertOutputContains " Configuration is affected by the following files" hopping
115
- assertOutputContains " - hops-0.project" hopping
116
-
117
- assertOutputContains
118
- (normalizeWindowsOutput " - hops-2.config \
119
- \ imported by: hops/hops-1.config \
120
- \ imported by: hops-0.project" )
121
- hopping
122
-
123
- assertOutputContains
124
- (normalizeWindowsOutput " - hops-4.config \
125
- \ imported by: hops/hops-3.config \
126
- \ imported by: hops-2.config \
127
- \ imported by: hops/hops-1.config \
128
- \ imported by: hops-0.project" )
129
- hopping
130
-
131
- assertOutputContains
132
- (normalizeWindowsOutput " - hops-6.config \
133
- \ imported by: hops/hops-5.config \
134
- \ imported by: hops-4.config \
135
- \ imported by: hops/hops-3.config \
136
- \ imported by: hops-2.config \
137
- \ imported by: hops/hops-1.config \
138
- \ imported by: hops-0.project" )
139
- hopping
140
-
141
- assertOutputContains
142
- (normalizeWindowsOutput " - hops-8.config \
143
- \ imported by: hops/hops-7.config \
144
- \ imported by: hops-6.config \
145
- \ imported by: hops/hops-5.config \
146
- \ imported by: hops-4.config \
147
- \ imported by: hops/hops-3.config \
148
- \ imported by: hops-2.config \
149
- \ imported by: hops/hops-1.config \
150
- \ imported by: hops-0.project" )
151
- hopping
152
113
153
- assertOutputContains
154
- (normalizeWindowsOutput " - hops/hops-1.config \
155
- \ imported by: hops-0.project" )
156
- hopping
157
-
158
- assertOutputContains
159
- (normalizeWindowsOutput " - hops/hops-3.config \
160
- \ imported by: hops-2.config \
161
- \ imported by: hops/hops-1.config \
162
- \ imported by: hops-0.project" )
163
- hopping
164
-
165
- assertOutputContains
166
- (normalizeWindowsOutput " - hops/hops-5.config \
167
- \ imported by: hops-4.config \
168
- \ imported by: hops/hops-3.config \
169
- \ imported by: hops-2.config \
170
- \ imported by: hops/hops-1.config \
171
- \ imported by: hops-0.project" )
172
- hopping
173
-
174
- assertOutputContains
175
- (normalizeWindowsOutput " - hops/hops-7.config \
176
- \ imported by: hops-6.config \
177
- \ imported by: hops/hops-5.config \
178
- \ imported by: hops-4.config \
179
- \ imported by: hops/hops-3.config \
180
- \ imported by: hops-2.config \
181
- \ imported by: hops/hops-1.config \
182
- \ imported by: hops-0.project" )
183
- hopping
184
-
185
- assertOutputContains
186
- (normalizeWindowsOutput " - hops/hops-9.config \
187
- \ imported by: hops-8.config \
188
- \ imported by: hops/hops-7.config \
189
- \ imported by: hops-6.config \
190
- \ imported by: hops/hops-5.config \
191
- \ imported by: hops-4.config \
192
- \ imported by: hops/hops-3.config \
193
- \ imported by: hops-2.config \
194
- \ imported by: hops/hops-1.config \
195
- \ imported by: hops-0.project" )
196
- hopping
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
197
172
198
173
-- The project is named oops as it is like hops but has conflicting constraints.
199
174
-- +-- oops-0.project
@@ -208,22 +183,25 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
208
183
-- +-- oops/oops-9.config (has conflicting constraints)
209
184
log " checking conflicting constraints skipping into a subfolder and then back out again and again"
210
185
oopsing <- fails $ cabal' " v2-build" [ " all" , " --project-file=oops-0.project" ]
211
- assertOutputContains " rejecting: hashable-1.4.2.0" oopsing
212
- assertOutputContains " rejecting: hashable-1.4.3.0" oopsing
213
- assertOutputContains " (constraint from oops-0.project requires ==1.4.3.0)" oopsing
214
186
215
- assertOutputContains
216
- (normalizeWindowsOutput " (constraint from oops/oops-9.config requires ==1.4.2.0) \
217
- \ imported by: oops-8.config \
218
- \ imported by: oops/oops-7.config \
219
- \ imported by: oops-6.config \
220
- \ imported by: oops/oops-5.config \
221
- \ imported by: oops-4.config \
222
- \ imported by: oops/oops-3.config \
223
- \ imported by: oops-2.config \
224
- \ imported by: oops/oops-1.config \
225
- \ imported by: oops-0.project" )
226
- oopsing
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
227
205
228
206
-- The project is named yops as it is like hops but with y's for forks.
229
207
-- +-- yops-0.project
@@ -264,13 +242,14 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
264
242
265
243
log " checking that missing package message lists configuration provenance"
266
244
missing <- fails $ cabal' " v2-build" [ " --project-file=cabal-missing-package.project" ]
267
- assertOutputContains
268
- (normalizeWindowsOutput " When using configuration from: \
269
- \ - cabal-missing-package.project \
270
- \ - missing/pkgs.config \
271
- \ - missing/pkgs/default.config \
272
- \The following errors occurred: \
273
- \ - The package location 'pkg-doesnt-exist' does not exist." )
274
- missing
245
+
246
+ " When using configuration from:\n \
247
+ \ - cabal-missing-package.project\n \
248
+ \ - missing/pkgs.config\n \
249
+ \ - missing/pkgs/default.config\n \
250
+ \The following errors occurred:\n \
251
+ \ - The package location 'pkg-doesnt-exist' does not exist."
252
+ & normalizeWindowsOutput
253
+ & flip (assertOn multilineNeedleHaystack) missing
275
254
276
255
return ()
0 commit comments