@@ -171,28 +171,28 @@ spec = do
171
171
let expected = " Raw command: podman exec --detach-keys \"\" ctx bash"
172
172
in show (proc " podman" [" exec" , " --detach-keys" , " " , " ctx" , " bash" ]) `shouldBe` expected
173
173
174
- describe " ProcessConfig" $ do
175
- it " Show shell-escapes arguments" $ do
174
+ describe " Show ProcessConfig" $ do
175
+ it " shell-escapes arguments" $ do
176
176
let processConfig = proc " echo" [" a" , " " , " \" b\" " , " 'c'" , " \\ d" ]
177
177
-- I promise this escaping behavior is correct; paste it into GHCi
178
178
-- `putStrLn` and then paste it into `sh` to verify.
179
179
show processConfig `shouldBe`
180
180
" Raw command: echo a \"\" \"\\\" b\\\"\" \" 'c'\" \"\\\\ d\" "
181
181
182
- it " Show displays working directory" $ do
182
+ it " displays working directory" $ do
183
183
let processConfig = setWorkingDir " puppy/doggy" $ proc " true" []
184
184
show processConfig `shouldBe`
185
185
" Raw command: true\n "
186
186
++ " Run from: puppy/doggy"
187
187
188
- it " Show displays environment (1 variable)" $ do
188
+ it " displays environment (1 variable)" $ do
189
189
let processConfig = setEnv [(" PUPPY" , " DOGGY" )] $ proc " true" []
190
190
show processConfig `shouldBe`
191
191
" Raw command: true\n "
192
192
++ " Environment:\n "
193
193
++ " PUPPY=DOGGY"
194
194
195
- it " Show displays environment (multiple variables)" $ do
195
+ it " displays environment (multiple variables)" $ do
196
196
let processConfig =
197
197
setEnv [ (" PUPPY" , " DOGGY" )
198
198
, (" SOUND" , " AWOO" )
@@ -206,7 +206,7 @@ spec = do
206
206
++ " SOUND=AWOO\n "
207
207
++ " HOWLING=RIGHT_NOW"
208
208
209
- it " Show displays working directory and environment" $ do
209
+ it " displays working directory and environment" $ do
210
210
let processConfig =
211
211
setEnv [ (" PUPPY" , " DOGGY" )
212
212
, (" SOUND" , " AWOO" )
@@ -221,8 +221,8 @@ spec = do
221
221
++ " SOUND=AWOO"
222
222
223
223
224
- describe " ExitCodeException" $ do
225
- it " Show " $ do
224
+ describe " Show ExitCodeException" $ do
225
+ it " shows ExitCodeException " $ do
226
226
-- Note that the `show` output ends with a newline, so functions
227
227
-- like `print` will output an extra blank line at the end of the
228
228
-- output.
@@ -243,36 +243,38 @@ spec = do
243
243
++ " Standard error:\n "
244
244
++ " Uh oh!\n "
245
245
246
- it " Show only stdout" $ do
247
- let exitCodeException =
248
- ExitCodeException
249
- { eceExitCode = ExitFailure 1
250
- , eceProcessConfig = proc " show-puppy" []
251
- , eceStdout = fromString " No puppies found???\n "
252
- , eceStderr = fromString " "
253
- }
254
- show exitCodeException `shouldBe`
255
- " Received ExitFailure 1 when running\n "
256
- ++ " Raw command: show-puppy\n "
257
- ++ " \n "
258
- ++ " Standard output:\n "
259
- ++ " No puppies found???\n "
260
-
261
- it " Show only stderr" $ do
262
- let exitCodeException =
263
- ExitCodeException
264
- { eceExitCode = ExitFailure 1
265
- , eceProcessConfig = proc " show-puppy" []
266
- , eceStdout = fromString " "
267
- , eceStderr = fromString " No puppies found???\n "
268
- }
269
- show exitCodeException `shouldBe`
270
- " Received ExitFailure 1 when running\n "
271
- ++ " Raw command: show-puppy\n "
272
- ++ " Standard error:\n "
273
- ++ " No puppies found???\n "
274
-
275
- it " Show does not trim stdout/stderr" $ do
246
+ context " without stderr" $ do
247
+ it " shows ExitCodeException" $ do
248
+ let exitCodeException =
249
+ ExitCodeException
250
+ { eceExitCode = ExitFailure 1
251
+ , eceProcessConfig = proc " show-puppy" []
252
+ , eceStdout = fromString " No puppies found???\n "
253
+ , eceStderr = fromString " "
254
+ }
255
+ show exitCodeException `shouldBe`
256
+ " Received ExitFailure 1 when running\n "
257
+ ++ " Raw command: show-puppy\n "
258
+ ++ " \n "
259
+ ++ " Standard output:\n "
260
+ ++ " No puppies found???\n "
261
+
262
+ context " without stdout" $ do
263
+ it " shows ExitCodeException" $ do
264
+ let exitCodeException =
265
+ ExitCodeException
266
+ { eceExitCode = ExitFailure 1
267
+ , eceProcessConfig = proc " show-puppy" []
268
+ , eceStdout = fromString " "
269
+ , eceStderr = fromString " No puppies found???\n "
270
+ }
271
+ show exitCodeException `shouldBe`
272
+ " Received ExitFailure 1 when running\n "
273
+ ++ " Raw command: show-puppy\n "
274
+ ++ " Standard error:\n "
275
+ ++ " No puppies found???\n "
276
+
277
+ it " does not trim stdout/stderr" $ do
276
278
-- This looks weird, and I think it would be better to strip the
277
279
-- whitespace from the output.
278
280
let exitCodeException =
@@ -292,37 +294,39 @@ spec = do
292
294
++ " Standard error:\n "
293
295
++ " \t \n doggy\n \t\n "
294
296
295
- it " Show displays weirdly with no newlines in stdout" $ do
296
- -- Sometimes, commands don't output _any_ newlines!
297
- let exitCodeException =
298
- ExitCodeException
299
- { eceExitCode = ExitFailure 1
300
- , eceProcessConfig = proc " detect-doggies" []
301
- , eceStdout = fromString " puppy"
302
- , eceStderr = fromString " "
303
- }
304
- show exitCodeException `shouldBe`
305
- " Received ExitFailure 1 when running\n "
306
- ++ " Raw command: detect-doggies\n "
307
- ++ " \n "
308
- ++ " Standard output:\n "
309
- ++ " puppy"
310
-
311
- it " Show displays weirdly with no newlines in stdout or stderr" $ do
312
- -- If the stderr isn't empty and stdout doesn't end with a newline,
313
- -- the blank line between the two sections disappears.
314
- let exitCodeException =
315
- ExitCodeException
316
- { eceExitCode = ExitFailure 1
317
- , eceProcessConfig = proc " detect-doggies" []
318
- , eceStdout = fromString " puppy"
319
- , eceStderr = fromString " doggy"
320
- }
321
- show exitCodeException `shouldBe`
322
- " Received ExitFailure 1 when running\n "
323
- ++ " Raw command: detect-doggies\n "
324
- ++ " \n "
325
- ++ " Standard output:\n "
326
- ++ " puppy\n "
327
- ++ " Standard error:\n "
328
- ++ " doggy"
297
+ context " without newlines in stdout" $ do
298
+ it " shows ExitCodeException" $ do
299
+ -- Sometimes, commands don't output _any_ newlines!
300
+ let exitCodeException =
301
+ ExitCodeException
302
+ { eceExitCode = ExitFailure 1
303
+ , eceProcessConfig = proc " detect-doggies" []
304
+ , eceStdout = fromString " puppy"
305
+ , eceStderr = fromString " "
306
+ }
307
+ show exitCodeException `shouldBe`
308
+ " Received ExitFailure 1 when running\n "
309
+ ++ " Raw command: detect-doggies\n "
310
+ ++ " \n "
311
+ ++ " Standard output:\n "
312
+ ++ " puppy"
313
+
314
+ context " without newlines in stdout or stderr" $ do
315
+ it " shows ExitCodeException" $ do
316
+ -- If the stderr isn't empty and stdout doesn't end with a newline,
317
+ -- the blank line between the two sections disappears.
318
+ let exitCodeException =
319
+ ExitCodeException
320
+ { eceExitCode = ExitFailure 1
321
+ , eceProcessConfig = proc " detect-doggies" []
322
+ , eceStdout = fromString " puppy"
323
+ , eceStderr = fromString " doggy"
324
+ }
325
+ show exitCodeException `shouldBe`
326
+ " Received ExitFailure 1 when running\n "
327
+ ++ " Raw command: detect-doggies\n "
328
+ ++ " \n "
329
+ ++ " Standard output:\n "
330
+ ++ " puppy\n "
331
+ ++ " Standard error:\n "
332
+ ++ " doggy"
0 commit comments