Skip to content
This repository
Browse code

Use Hspec's shouldBe instead of HUnit's @?=

  • Loading branch information...
commit a1dd86cfcd602d2ad7ffa031fe52c6b29ad97d1b 1 parent c2fa1fc
Simon Hengel authored July 13, 2012
1  attoparsec-conduit/attoparsec-conduit.cabal
@@ -30,7 +30,6 @@ test-suite test
30 30
     build-depends:   conduit
31 31
                    , base
32 32
                    , hspec == 1.3.*
33  
-                   , HUnit
34 33
                    , text
35 34
                    , resourcet
36 35
                    , attoparsec
9  attoparsec-conduit/test/main.hs
@@ -2,7 +2,6 @@
2 2
 {-# LANGUAGE CPP #-}
3 3
 {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
4 4
 import Test.Hspec
5  
-import Test.HUnit
6 5
 import Control.Exception (fromException)
7 6
 
8 7
 import Data.Conduit
@@ -27,7 +26,7 @@ main = hspec $ do
27 26
                 Left e ->
28 27
                     case fromException e of
29 28
                         Just pe -> do
30  
-                            errorPosition pe @?= Position badLine badCol
  29
+                            errorPosition pe `shouldBe` Position badLine badCol
31 30
         it "works for bytestring" $ do
32 31
             let input = ["aaa\na", "aaa\n\n", "aaa", "aab\n\naaaa"]
33 32
                 badLine = 4
@@ -39,7 +38,7 @@ main = hspec $ do
39 38
                 Left e ->
40 39
                     case fromException e of
41 40
                         Just pe -> do
42  
-                            errorPosition pe @?= Position badLine badCol
  41
+                            errorPosition pe `shouldBe` Position badLine badCol
43 42
         it "works in last chunk" $ do
44 43
             let input = ["aaa\na", "aaa\n\n", "aaa", "aab\n\naaaa"]
45 44
                 badLine = 6
@@ -51,7 +50,7 @@ main = hspec $ do
51 50
                 Left e ->
52 51
                     case fromException e of
53 52
                         Just pe -> do
54  
-                            errorPosition pe @?= Position badLine badCol
  53
+                            errorPosition pe `shouldBe` Position badLine badCol
55 54
         it "works in last chunk" $ do
56 55
             let input = ["aaa\na", "aaa\n\n", "aaa", "aa\n\naaaab"]
57 56
                 badLine = 6
@@ -63,4 +62,4 @@ main = hspec $ do
63 62
                 Left e ->
64 63
                     case fromException e of
65 64
                         Just pe -> do
66  
-                            errorPosition pe @?= Position badLine badCol
  65
+                            errorPosition pe `shouldBe` Position badLine badCol
1  base64-conduit/base64-conduit.cabal
@@ -29,7 +29,6 @@ test-suite test
29 29
                    , base
30 30
                    , hspec == 1.3.*
31 31
                    , bytestring
32  
-                   , HUnit
33 32
                    , QuickCheck
34 33
                    , base64-conduit
35 34
                    , base64-bytestring
1  blaze-builder-conduit/blaze-builder-conduit.cabal
@@ -31,7 +31,6 @@ test-suite test
31 31
     build-depends:   conduit
32 32
                    , base
33 33
                    , hspec == 1.3.*
34  
-                   , HUnit
35 34
                    , QuickCheck
36 35
                    , bytestring
37 36
                    , blaze-builder
9  blaze-builder-conduit/test/main.hs
@@ -2,7 +2,6 @@
2 2
 {-# LANGUAGE CPP #-}
3 3
 import Test.Hspec
4 4
 import Test.Hspec.QuickCheck (prop)
5  
-import Test.HUnit
6 5
 
7 6
 import qualified Data.Conduit as C
8 7
 import qualified Data.Conduit.List as CL
@@ -31,20 +30,20 @@ main = hspec $ do
31 30
             let lbs = toLazyByteString $ mconcat builders
32 31
             let src = mconcat $ map (CL.sourceList . return) builders
33 32
             outBss <- src C.$= builderToByteString C.$$ CL.consume
34  
-            lbs @=? L.fromChunks outBss
  33
+            lbs `shouldBe` L.fromChunks outBss
35 34
 
36 35
         it "works for lazy bytestring insertion" $ do
37 36
             let builders = replicate 10000 (insertLazyByteString "hello world!")
38 37
             let lbs = toLazyByteString $ mconcat builders
39 38
             let src = mconcat $ map (CL.sourceList . return) builders
40 39
             outBss <- src C.$= builderToByteString C.$$ CL.consume
41  
-            lbs @=? L.fromChunks outBss
  40
+            lbs `shouldBe` L.fromChunks outBss
42 41
 
43 42
         it "flush shouldn't bring in empty strings." $ do
44 43
             let dat = ["hello", "world"]
45 44
                 src = CL.sourceList dat C.$= CL.map ((`mappend` flush) . fromByteString)
46 45
             out <- src C.$= builderToByteString C.$$ CL.consume
47  
-            dat @=? out
  46
+            dat `shouldBe` out
48 47
 
49 48
         prop "flushing" $ \bss' -> runST $ do
50 49
             let bss = concatMap (\bs -> [C.Chunk $ S.pack bs, C.Flush]) $ filter (not . null) bss'
@@ -59,4 +58,4 @@ main = hspec $ do
59 58
             bss <- src C.$$ builderToByteStringFlush C.=$ CL.consume
60 59
             let unFlush (C.Chunk x) = [x]
61 60
                 unFlush C.Flush = []
62  
-            L.fromChunks (concatMap unFlush bss) @?= lbs
  61
+            L.fromChunks (concatMap unFlush bss) `shouldBe` lbs
1  conduit/conduit.cabal
@@ -73,7 +73,6 @@ test-suite test
73 73
     build-depends:   conduit
74 74
                    , base
75 75
                    , hspec == 1.3.*
76  
-                   , HUnit
77 76
                    , QuickCheck
78 77
                    , bytestring
79 78
                    , transformers
181  conduit/test/main.hs
@@ -2,7 +2,6 @@
2 2
 {-# LANGUAGE CPP #-}
3 3
 import Test.Hspec
4 4
 import Test.Hspec.QuickCheck (prop)
5  
-import Test.HUnit
6 5
 
7 6
 import qualified Data.Conduit as C
8 7
 import qualified Data.Conduit.Util as C
@@ -41,19 +40,19 @@ main = hspec $ do
41 40
                   strings <- CL.map show C.=$ CL.take 5
42 41
                   liftIO $ putStr $ unlines strings
43 42
                   CL.fold (+) 0
44  
-            40 @?= x
  43
+            40 `shouldBe` x
45 44
 
46 45
         it "correctly consumes a chunked resource" $ do
47 46
             x <- runResourceT $ (CL.sourceList [1..5 :: Int] `mappend` CL.sourceList [6..10]) C.$$ do
48 47
                 strings <- CL.map show C.=$ CL.take 5
49 48
                 liftIO $ putStr $ unlines strings
50 49
                 CL.fold (+) 0
51  
-            40 @?= x
  50
+            40 `shouldBe` x
52 51
 
53 52
     describe "filter" $ do
54 53
         it "even" $ do
55 54
             x <- runResourceT $ CL.sourceList [1..10] C.$$ CL.filter even C.=$ CL.consume
56  
-            x @?= filter even [1..10 :: Int]
  55
+            x `shouldBe` filter even [1..10 :: Int]
57 56
 
58 57
     describe "ResourceT" $ do
59 58
         it "resourceForkIO" $ do
@@ -77,12 +76,12 @@ main = hspec $ do
77 76
             -- give enough of a chance to the cleanup code to finish
78 77
             threadDelay 1000
79 78
             res <- I.readIORef counter
80  
-            res @?= (0 :: Int)
  79
+            res `shouldBe` (0 :: Int)
81 80
 
82 81
     describe "sum" $ do
83 82
         it "works for 1..10" $ do
84 83
             x <- runResourceT $ CL.sourceList [1..10] C.$$ CL.fold (+) (0 :: Int)
85  
-            x @?= sum [1..10]
  84
+            x `shouldBe` sum [1..10]
86 85
         prop "is idempotent" $ \list ->
87 86
             (runST $ CL.sourceList list C.$$ CL.fold (+) (0 :: Int))
88 87
             == sum list
@@ -94,19 +93,19 @@ main = hspec $ do
94 93
                 seed = 10 :: Int
95 94
             x <- CL.unfold f seed C.$$ CL.consume
96 95
             let y = DL.unfoldr f seed
97  
-            x @?= y
  96
+            x `shouldBe` y
98 97
 
99 98
     describe "Monoid instance for Source" $ do
100 99
         it "mappend" $ do
101 100
             x <- runResourceT $ (CL.sourceList [1..5 :: Int] `mappend` CL.sourceList [6..10]) C.$$ CL.fold (+) 0
102  
-            x @?= sum [1..10]
  101
+            x `shouldBe` sum [1..10]
103 102
         it "mconcat" $ do
104 103
             x <- runResourceT $ mconcat
105 104
                 [ CL.sourceList [1..5 :: Int]
106 105
                 , CL.sourceList [6..10]
107 106
                 , CL.sourceList [11..20]
108 107
                 ] C.$$ CL.fold (+) 0
109  
-            x @?= sum [1..20]
  108
+            x `shouldBe` sum [1..20]
110 109
 
111 110
     describe "file access" $ do
112 111
         it "read" $ do
@@ -117,7 +116,7 @@ main = hspec $ do
117 116
         it "read range" $ do
118 117
             S.writeFile "tmp" "0123456789"
119 118
             bss <- runResourceT $ CB.sourceFileRange "tmp" (Just 2) (Just 3) C.$$ CL.consume
120  
-            S.concat bss @?= "234"
  119
+            S.concat bss `shouldBe` "234"
121 120
 
122 121
         it "write" $ do
123 122
             runResourceT $ CB.sourceFile "conduit.cabal" C.$$ CB.sinkFile "tmp"
@@ -156,13 +155,13 @@ main = hspec $ do
156 155
             x <- runResourceT $ CL.sourceList [1..10] C.$$ do
157 156
                 _ <- CL.take 5
158 157
                 CL.fold (+) (0 :: Int)
159  
-            x @?= sum [6..10]
  158
+            x `shouldBe` sum [6..10]
160 159
 
161 160
     describe "Applicative instance for Sink" $ do
162 161
         it "<$> and <*>" $ do
163 162
             x <- runResourceT $ CL.sourceList [1..10] C.$$
164 163
                 (+) <$> pure 5 <*> CL.fold (+) (0 :: Int)
165  
-            x @?= sum [1..10] + 5
  164
+            x `shouldBe` sum [1..10] + 5
166 165
 
167 166
     describe "resumable sources" $ do
168 167
         it "simple" $ do
@@ -172,9 +171,9 @@ main = hspec $ do
172 171
                 (src3, y) <- src2 C.$$++ CL.fold (+) 0
173 172
                 z <- src3 C.$$+- CL.consume
174 173
                 return (x, y, z)
175  
-            x @?= [1..5] :: IO ()
176  
-            y @?= sum [6..10]
177  
-            z @?= []
  174
+            x `shouldBe` [1..5] :: IO ()
  175
+            y `shouldBe` sum [6..10]
  176
+            z `shouldBe` []
178 177
 
179 178
     describe "conduits" $ do
180 179
         it "map, left" $ do
@@ -182,61 +181,61 @@ main = hspec $ do
182 181
                 CL.sourceList [1..10]
183 182
                     C.$= CL.map (* 2)
184 183
                     C.$$ CL.fold (+) 0
185  
-            x @?= 2 * sum [1..10 :: Int]
  184
+            x `shouldBe` 2 * sum [1..10 :: Int]
186 185
 
187 186
         it "map, right" $ do
188 187
             x <- runResourceT $
189 188
                 CL.sourceList [1..10]
190 189
                     C.$$ CL.map (* 2)
191 190
                     C.=$ CL.fold (+) 0
192  
-            x @?= 2 * sum [1..10 :: Int]
  191
+            x `shouldBe` 2 * sum [1..10 :: Int]
193 192
 
194 193
         it "groupBy" $ do
195 194
             let input = [1::Int, 1, 2, 3, 3, 3, 4, 5, 5]
196 195
             x <- runResourceT $ CL.sourceList input
197 196
                     C.$$ CL.groupBy (==)
198 197
                     C.=$ CL.consume
199  
-            x @?= DL.groupBy (==) input
  198
+            x `shouldBe` DL.groupBy (==) input
200 199
 
201 200
         it "groupBy (nondup begin/end)" $ do
202 201
             let input = [1::Int, 2, 3, 3, 3, 4, 5]
203 202
             x <- runResourceT $ CL.sourceList input
204 203
                     C.$$ CL.groupBy (==)
205 204
                     C.=$ CL.consume
206  
-            x @?= DL.groupBy (==) input
  205
+            x `shouldBe` DL.groupBy (==) input
207 206
 
208 207
         it "mapMaybe" $ do
209 208
             let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]
210 209
             x <- runResourceT $ CL.sourceList input
211 210
                     C.$$ CL.mapMaybe ((+2) <$>)
212 211
                     C.=$ CL.consume
213  
-            x @?= [3, 4, 5]
  212
+            x `shouldBe` [3, 4, 5]
214 213
 
215 214
         it "mapMaybeM" $ do
216 215
             let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]
217 216
             x <- runResourceT $ CL.sourceList input
218 217
                     C.$$ CL.mapMaybeM (return . ((+2) <$>))
219 218
                     C.=$ CL.consume
220  
-            x @?= [3, 4, 5]
  219
+            x `shouldBe` [3, 4, 5]
221 220
 
222 221
         it "catMaybes" $ do
223 222
             let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]
224 223
             x <- runResourceT $ CL.sourceList input
225 224
                     C.$$ CL.catMaybes
226 225
                     C.=$ CL.consume
227  
-            x @?= [1, 2, 3]
  226
+            x `shouldBe` [1, 2, 3]
228 227
 
229 228
         it "concatMap" $ do
230 229
             let input = [1, 11, 21]
231 230
             x <- runResourceT $ CL.sourceList input
232 231
                     C.$$ CL.concatMap (\i -> enumFromTo i (i + 9))
233 232
                     C.=$ CL.fold (+) (0 :: Int)
234  
-            x @?= sum [1..30]
  233
+            x `shouldBe` sum [1..30]
235 234
 
236 235
         it "bind together" $ do
237 236
             let conduit = CL.map (+ 5) C.=$= CL.map (* 2)
238 237
             x <- runResourceT $ CL.sourceList [1..10] C.$= conduit C.$$ CL.fold (+) 0
239  
-            x @?= sum (map (* 2) $ map (+ 5) [1..10 :: Int])
  238
+            x `shouldBe` sum (map (* 2) $ map (+ 5) [1..10 :: Int])
240 239
 
241 240
 #if !FAST
242 241
     describe "isolate" $ do
@@ -246,8 +245,8 @@ main = hspec $ do
246 245
                 (src2, x) <- src1 C.$= CL.isolate 5 C.$$+ CL.consume
247 246
                 y <- src2 C.$$+- CL.consume
248 247
                 return (x, y)
249  
-            x @?= [1..5]
250  
-            y @?= []
  248
+            x `shouldBe` [1..5]
  249
+            y `shouldBe` []
251 250
 
252 251
         it "bound to sink, non-resumable" $ do
253 252
             (x, y) <- runResourceT $ do
@@ -255,8 +254,8 @@ main = hspec $ do
255 254
                     x <- CL.isolate 5 C.=$ CL.consume
256 255
                     y <- CL.consume
257 256
                     return (x, y)
258  
-            x @?= [1..5]
259  
-            y @?= [6..10]
  257
+            x `shouldBe` [1..5]
  258
+            y `shouldBe` [6..10]
260 259
 
261 260
         it "bound to sink, resumable" $ do
262 261
             (x, y) <- runResourceT $ do
@@ -264,14 +263,14 @@ main = hspec $ do
264 263
                 (src2, x) <- src1 C.$$+ CL.isolate 5 C.=$ CL.consume
265 264
                 y <- src2 C.$$+- CL.consume
266 265
                 return (x, y)
267  
-            x @?= [1..5]
268  
-            y @?= [6..10]
  266
+            x `shouldBe` [1..5]
  267
+            y `shouldBe` [6..10]
269 268
 
270 269
         it "consumes all data" $ do
271 270
             x <- runResourceT $ CL.sourceList [1..10 :: Int] C.$$ do
272 271
                 CL.isolate 5 C.=$ CL.sinkNull
273 272
                 CL.consume
274  
-            x @?= [6..10]
  273
+            x `shouldBe` [6..10]
275 274
 
276 275
     describe "lazy" $ do
277 276
         it' "works inside a ResourceT" $ runResourceT $ do
@@ -287,15 +286,15 @@ main = hspec $ do
287 286
                             _ -> do
288 287
                                 count <- liftIO $ I.atomicModifyIORef counter
289 288
                                     (\j -> (j + 1, j + 1))
290  
-                                liftIO $ count @?= i
  289
+                                liftIO $ count `shouldBe` i
291 290
                         return res
292 291
                             )
293 292
             nums <- CLazy.lazyConsume $ mconcat $ map incr [1..10]
294  
-            liftIO $ nums @?= [1..10]
  293
+            liftIO $ nums `shouldBe` [1..10]
295 294
 
296 295
         it' "returns nothing outside ResourceT" $ do
297 296
             bss <- runResourceT $ CLazy.lazyConsume $ CB.sourceFile "test/main.hs"
298  
-            bss @?= []
  297
+            bss `shouldBe` []
299 298
 
300 299
     describe "sequence" $ do
301 300
         it "simple sink" $ do
@@ -308,7 +307,7 @@ main = hspec $ do
308 307
             res <- runResourceT $ CL.sourceList [1..11 :: Int]
309 308
                              C.$= CL.sequence sumSink
310 309
                              C.$$ CL.consume
311  
-            res @?= [3, 7, 11, 15, 19, 11]
  310
+            res `shouldBe` [3, 7, 11, 15, 19, 11]
312 311
 
313 312
         it "sink with unpull behaviour" $ do
314 313
             let sumSink = do
@@ -320,7 +319,7 @@ main = hspec $ do
320 319
             res <- runResourceT $ CL.sourceList [1..11 :: Int]
321 320
                              C.$= CL.sequence sumSink
322 321
                              C.$$ CL.consume
323  
-            res @?= [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 11]
  322
+            res `shouldBe` [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 11]
324 323
 
325 324
 
326 325
     describe "sequenceSink" $ do
@@ -333,7 +332,7 @@ main = hspec $ do
333 332
             res <- runResourceT $ CL.sourceList [1..10 :: Int]
334 333
                            C.$= conduit
335 334
                            C.$$ CL.consume
336  
-            res @?= [3, 6, 9]
  335
+            res `shouldBe` [3, 6, 9]
337 336
         it "finishes on new state" $ do
338 337
             let sink () = do
339 338
                 x <- CL.head
@@ -341,7 +340,7 @@ main = hspec $ do
341 340
             let conduit = C.sequenceSink () sink
342 341
             res <- runResourceT $ CL.sourceList [1..10 :: Int]
343 342
                         C.$= conduit C.$$ CL.consume
344  
-            res @?= [1..10]
  343
+            res `shouldBe` [1..10]
345 344
         it "switch to a conduit" $ do
346 345
             let sink () = do
347 346
                 _ <- CL.drop 4
@@ -350,7 +349,7 @@ main = hspec $ do
350 349
             res <- runResourceT $ CL.sourceList [1..10 :: Int]
351 350
                             C.$= conduit
352 351
                             C.$$ CL.consume
353  
-            res @?= [6, 8, 10]
  352
+            res `shouldBe` [6, 8, 10]
354 353
 #endif
355 354
 
356 355
     describe "peek" $ do
@@ -359,7 +358,7 @@ main = hspec $ do
359 358
                 a <- CL.peek
360 359
                 b <- CL.consume
361 360
                 return (a, b)
362  
-            (a, b) @?= (Just 1, [1..10])
  361
+            (a, b) `shouldBe` (Just 1, [1..10])
363 362
 
364 363
     describe "text" $ do
365 364
         let go enc tenc cenc = do
@@ -402,21 +401,21 @@ main = hspec $ do
402 401
                 [[T.pack "ab", T.pack "cd", T.pack "e"]]
403 402
         it "is not too eager" $ do
404 403
             x <- CL.sourceList ["foobarbaz", error "ignore me"] C.$$ CT.decode CT.utf8 C.=$ CL.head
405  
-            x @?= Just "foobarbaz"
  404
+            x `shouldBe` Just "foobarbaz"
406 405
 
407 406
     describe "binary isolate" $ do
408 407
         it "works" $ do
409 408
             bss <- runResourceT $ CL.sourceList (replicate 1000 "X")
410 409
                            C.$= CB.isolate 6
411 410
                            C.$$ CL.consume
412  
-            S.concat bss @?= "XXXXXX"
  411
+            S.concat bss `shouldBe` "XXXXXX"
413 412
     describe "unbuffering" $ do
414 413
         it "works" $ do
415 414
             x <- runResourceT $ do
416 415
                 let src1 = CL.sourceList [1..10 :: Int]
417 416
                 (src2, ()) <- src1 C.$$+ CL.drop 5
418 417
                 src2 C.$$+- CL.fold (+) 0
419  
-            x @?= sum [6..10]
  418
+            x `shouldBe` sum [6..10]
420 419
 
421 420
     describe "operators" $ do
422 421
         it "only use =$=" $
@@ -427,7 +426,7 @@ main = hspec $ do
427 426
              C.=$  CL.mapM (return . (* 2))
428 427
              C.=$  CL.map (`div` 2)
429 428
              C.=$  CL.fold (+) 0
430  
-            ) @?= sum [1..10]
  429
+            ) `shouldBe` sum [1..10]
431 430
         it "only use =$" $
432 431
             runIdentity
433 432
             (    CL.sourceList [1..10 :: Int]
@@ -436,7 +435,7 @@ main = hspec $ do
436 435
               C.=$ CL.map (* 2)
437 436
               C.=$ CL.map (`div` 2)
438 437
               C.=$ CL.fold (+) 0
439  
-            ) @?= sum [1..10]
  438
+            ) `shouldBe` sum [1..10]
440 439
         it "chain" $ do
441 440
             x <-      CL.sourceList [1..10 :: Int]
442 441
                 C.$=  CL.map (+ 1)
@@ -450,14 +449,14 @@ main = hspec $ do
450 449
                 C.=$  CL.map (+ 1)
451 450
                 C.=$  CL.map (subtract 3)
452 451
                 C.=$  CL.fold (+) 0
453  
-            x @?= sum [1..10]
  452
+            x `shouldBe` sum [1..10]
454 453
 
455 454
 
456 455
     describe "properly using binary file reading" $ do
457 456
         it "sourceFile" $ do
458 457
             x <- runResourceT $ CB.sourceFile "test/random" C.$$ CL.consume
459 458
             lbs <- L.readFile "test/random"
460  
-            L.fromChunks x @?= lbs
  459
+            L.fromChunks x `shouldBe` lbs
461 460
 
462 461
     describe "binary head" $ do
463 462
         let go lbs = do
@@ -508,33 +507,33 @@ main = hspec $ do
508 507
       -- Taking nothing should result in an empty Bytestring
509 508
       it "nothing" $ do
510 509
         (a, b) <- runResourceT $ go 0 ["abc", "defg"]
511  
-        a              @?= L.empty
512  
-        L.fromChunks b @?= "abcdefg"
  510
+        a              `shouldBe` L.empty
  511
+        L.fromChunks b `shouldBe` "abcdefg"
513 512
 
514 513
       it "normal" $ do
515 514
         (a, b) <- runResourceT $ go 4 ["abc", "defg"]
516  
-        a              @?= "abcd"
517  
-        L.fromChunks b @?= "efg"
  515
+        a              `shouldBe` "abcd"
  516
+        L.fromChunks b `shouldBe` "efg"
518 517
 
519 518
       -- Taking exactly the data that is available should result in no
520 519
       -- leftover.
521 520
       it "all" $ do
522 521
         (a, b) <- runResourceT $ go 7 ["abc", "defg"]
523  
-        a @?= "abcdefg"
524  
-        b @?= []
  522
+        a `shouldBe` "abcdefg"
  523
+        b `shouldBe` []
525 524
 
526 525
       -- Take as much as possible.
527 526
       it "more" $ do
528 527
         (a, b) <- runResourceT $ go 10 ["abc", "defg"]
529  
-        a @?= "abcdefg"
530  
-        b @?= []
  528
+        a `shouldBe` "abcdefg"
  529
+        b `shouldBe` []
531 530
 
532 531
     describe "normalFuseLeft" $ do
533 532
         it "does not double close conduit" $ do
534 533
             x <- runResourceT $ do
535 534
                 let src = CL.sourceList ["foobarbazbin"]
536 535
                 src C.$= CB.isolate 10 C.$$ CL.head
537  
-            x @?= Just "foobarbazb"
  536
+            x `shouldBe` Just "foobarbazb"
538 537
 
539 538
     describe "binary" $ do
540 539
         prop "lines" $ \bss' -> runIdentity $ do
@@ -548,7 +547,7 @@ main = hspec $ do
548 547
         it "terminates early" $ do
549 548
             let src = forever $ CI.yield ()
550 549
             x <- src C.$$ CL.head
551  
-            x @?= Just ()
  550
+            x `shouldBe` Just ()
552 551
         it "bracket" $ do
553 552
             ref <- I.newIORef (0 :: Int)
554 553
             let src = CI.bracketP
@@ -556,9 +555,9 @@ main = hspec $ do
556 555
                     (\() -> I.modifyIORef ref (+ 2))
557 556
                     (\() -> forever $ CI.yield (1 :: Int))
558 557
             val <- C.runResourceT $ src C.$$ CL.isolate 10 C.=$ CL.fold (+) 0
559  
-            val @?= 10
  558
+            val `shouldBe` 10
560 559
             i <- I.readIORef ref
561  
-            i @?= 3
  560
+            i `shouldBe` 3
562 561
         it "bracket skipped if not needed" $ do
563 562
             ref <- I.newIORef (0 :: Int)
564 563
             let src = CI.bracketP
@@ -567,9 +566,9 @@ main = hspec $ do
567 566
                     (\() -> forever $ CI.yield (1 :: Int))
568 567
                 src' = CL.sourceList $ repeat 1
569 568
             val <- C.runResourceT $ (src' >> src) C.$$ CL.isolate 10 C.=$ CL.fold (+) 0
570  
-            val @?= 10
  569
+            val `shouldBe` 10
571 570
             i <- I.readIORef ref
572  
-            i @?= 0
  571
+            i `shouldBe` 0
573 572
         it "bracket + toPipe" $ do
574 573
             ref <- I.newIORef (0 :: Int)
575 574
             let src = CI.bracketP
@@ -577,9 +576,9 @@ main = hspec $ do
577 576
                     (\() -> I.modifyIORef ref (+ 2))
578 577
                     (\() -> forever $ CI.yield (1 :: Int))
579 578
             val <- C.runResourceT $ src C.$$ CL.isolate 10 C.=$ CL.fold (+) 0
580  
-            val @?= 10
  579
+            val `shouldBe` 10
581 580
             i <- I.readIORef ref
582  
-            i @?= 3
  581
+            i `shouldBe` 3
583 582
         it "bracket skipped if not needed" $ do
584 583
             ref <- I.newIORef (0 :: Int)
585 584
             let src = CI.bracketP
@@ -588,9 +587,9 @@ main = hspec $ do
588 587
                     (\() -> forever $ CI.yield (1 :: Int))
589 588
                 src' = CL.sourceList $ repeat 1
590 589
             val <- C.runResourceT $ (src' >> src) C.$$ CL.isolate 10 C.=$ CL.fold (+) 0
591  
-            val @?= 10
  590
+            val `shouldBe` 10
592 591
             i <- I.readIORef ref
593  
-            i @?= 0
  592
+            i `shouldBe` 0
594 593
 
595 594
     describe "invariant violations" $ do
596 595
         it "leftovers without input" $ do
@@ -601,17 +600,17 @@ main = hspec $ do
601 600
 
602 601
             _ <- CI.yield 1 C.$$ adder
603 602
             x <- I.readIORef ref
604  
-            x @?= [1 :: Int]
  603
+            x `shouldBe` [1 :: Int]
605 604
             I.writeIORef ref []
606 605
 
607 606
             _ <- CI.yield 1 C.$$ (residue 2 >> residue 3) >> adder
608 607
             y <- I.readIORef ref
609  
-            y @?= [1, 2, 3]
  608
+            y `shouldBe` [1, 2, 3]
610 609
             I.writeIORef ref []
611 610
 
612 611
             _ <- CI.yield 1 C.$$ residue 2 >> (residue 3 >> adder)
613 612
             z <- I.readIORef ref
614  
-            z @?= [1, 2, 3]
  613
+            z `shouldBe` [1, 2, 3]
615 614
             I.writeIORef ref []
616 615
 
617 616
     describe "sane yield/await'" $ do
@@ -620,17 +619,17 @@ main = hspec $ do
620 619
                 src [] = return ()
621 620
                 src (x:xs) = CI.yield x >> src xs
622 621
             x <- src is C.$$ CL.take 10
623  
-            x @?= [1..10 :: Int]
  622
+            x `shouldBe` [1..10 :: Int]
624 623
         it' "yield terminates (2)" $ do
625 624
             let is = [1..10] ++ undefined
626 625
             x <- mapM_ CI.yield is C.$$ CL.take 10
627  
-            x @?= [1..10 :: Int]
  626
+            x `shouldBe` [1..10 :: Int]
628 627
         it' "yieldOr finalizer called" $ do
629 628
             iref <- I.newIORef (0 :: Int)
630 629
             let src = mapM_ (\i -> C.yieldOr i $ I.writeIORef iref i) [1..]
631 630
             src C.$$ CL.isolate 10 C.=$ CL.sinkNull
632 631
             x <- I.readIORef iref
633  
-            x @?= 10
  632
+            x `shouldBe` 10
634 633
 
635 634
     describe "upstream results" $ do
636 635
         it' "works" $ do
@@ -639,15 +638,15 @@ main = hspec $ do
639 638
                 passFold :: (b -> a -> b) -> b -> C.Pipe l a a () IO b
640 639
                 passFold f b = C.await >>= maybe (return b) (\a -> let b' = f b a in b' `seq` C.yield a >> passFold f b')
641 640
             (x, y) <- CI.runPipe $ CL.sourceList [1..10 :: Int] C.>+> passFold (+) 0 C.>+>  foldUp (*) 1
642  
-            (x, y) @?= (sum [1..10], product [1..10])
  641
+            (x, y) `shouldBe` (sum [1..10], product [1..10])
643 642
 
644 643
     describe "input/output mapping" $ do
645 644
         it' "mapOutput" $ do
646 645
             x <- CI.mapOutput (+ 1) (CL.sourceList [1..10 :: Int]) C.$$ CL.fold (+) 0
647  
-            x @?= sum [2..11]
  646
+            x `shouldBe` sum [2..11]
648 647
         it' "mapOutputMaybe" $ do
649 648
             x <- CI.mapOutputMaybe (\i -> if even i then Just i else Nothing) (CL.sourceList [1..10 :: Int]) C.$$ CL.fold (+) 0
650  
-            x @?= sum [2, 4..10]
  649
+            x `shouldBe` sum [2, 4..10]
651 650
         it' "mapInput" $ do
652 651
             xyz <- (CL.sourceList $ map show [1..10 :: Int]) C.$$ do
653 652
                 (x, y) <- CI.mapInput read (Just . show) $ ((do
@@ -657,17 +656,17 @@ main = hspec $ do
657 656
                 z <- CL.consume
658 657
                 return (x, y, concat z)
659 658
 
660  
-            xyz @?= (sum [1..5], Just 6, "678910")
  659
+            xyz `shouldBe` (sum [1..5], Just 6, "678910")
661 660
 
662 661
     describe "left/right identity" $ do
663 662
         it' "left identity" $ do
664 663
             x <- CL.sourceList [1..10 :: Int] C.$$ CI.idP C.=$ CL.fold (+) 0
665 664
             y <- CL.sourceList [1..10 :: Int] C.$$ CL.fold (+) 0
666  
-            x @?= y
  665
+            x `shouldBe` y
667 666
         it' "right identity" $ do
668 667
             x <- CI.runPipe $ CL.sourceList [1..10 :: Int] C.>+> CL.fold (+) 0 C.>+> CI.idP
669 668
             y <- CI.runPipe $ CL.sourceList [1..10 :: Int] C.>+> CL.fold (+) 0
670  
-            x @?= y
  669
+            x `shouldBe` y
671 670
 
672 671
     describe "generalizing" $ do
673 672
         it' "works" $ do
@@ -675,19 +674,19 @@ main = hspec $ do
675 674
                    $ CI.sourceToPipe  (CL.sourceList [1..10 :: Int])
676 675
                C.>+> CI.conduitToPipe (CL.map (+ 1))
677 676
                C.>+> CI.sinkToPipe    (CL.fold (+) 0)
678  
-            x @?= sum [2..11]
  677
+            x `shouldBe` sum [2..11]
679 678
 
680 679
     describe "withUpstream" $ do
681 680
         it' "works" $ do
682 681
             let src = CL.sourceList [1..10 :: Int] >> return True
683 682
                 sink = C.withUpstream $ CL.fold (+) 0
684 683
             res <- C.runPipe $ src C.>+> sink
685  
-            res @?= (True, sum [1..10])
  684
+            res `shouldBe` (True, sum [1..10])
686 685
 
687 686
     describe "iterate" $ do
688 687
         it' "works" $ do
689 688
             res <- CL.iterate (+ 1) (1 :: Int) C.$$ CL.isolate 10 C.=$ CL.fold (+) 0
690  
-            res @?= sum [1..10]
  689
+            res `shouldBe` sum [1..10]
691 690
             -}
692 691
 
693 692
     describe "unwrapResumable" $ do
@@ -700,17 +699,17 @@ main = hspec $ do
700 699
             (rsrc0, Just ()) <- src0 C.$$+ CL.head
701 700
 
702 701
             x0 <- I.readIORef ref
703  
-            x0 @?= 0
  702
+            x0 `shouldBe` 0
704 703
 
705 704
             (_, final) <- C.unwrapResumable rsrc0
706 705
 
707 706
             x1 <- I.readIORef ref
708  
-            x1 @?= 0
  707
+            x1 `shouldBe` 0
709 708
 
710 709
             final
711 710
 
712 711
             x2 <- I.readIORef ref
713  
-            x2 @?= 1
  712
+            x2 `shouldBe` 1
714 713
 
715 714
         it' "isn't called twice" $ do
716 715
             ref <- I.newIORef (0 :: Int)
@@ -720,22 +719,22 @@ main = hspec $ do
720 719
             (rsrc0, Just ()) <- src0 C.$$+ CL.head
721 720
 
722 721
             x0 <- I.readIORef ref
723  
-            x0 @?= 0
  722
+            x0 `shouldBe` 0
724 723
 
725 724
             (src1, final) <- C.unwrapResumable rsrc0
726 725
 
727 726
             x1 <- I.readIORef ref
728  
-            x1 @?= 0
  727
+            x1 `shouldBe` 0
729 728
 
730 729
             Just () <- src1 C.$$ CL.head
731 730
 
732 731
             x2 <- I.readIORef ref
733  
-            x2 @?= 2
  732
+            x2 `shouldBe` 2
734 733
 
735 734
             final
736 735
 
737 736
             x3 <- I.readIORef ref
738  
-            x3 @?= 2
  737
+            x3 `shouldBe` 2
739 738
 
740 739
         it' "source isn't used" $ do
741 740
             ref <- I.newIORef (0 :: Int)
@@ -745,22 +744,22 @@ main = hspec $ do
745 744
             (rsrc0, Just ()) <- src0 C.$$+ CL.head
746 745
 
747 746
             x0 <- I.readIORef ref
748  
-            x0 @?= 0
  747
+            x0 `shouldBe` 0
749 748
 
750 749
             (src1, final) <- C.unwrapResumable rsrc0
751 750
 
752 751
             x1 <- I.readIORef ref
753  
-            x1 @?= 0
  752
+            x1 `shouldBe` 0
754 753
 
755 754
             () <- src1 C.$$ return ()
756 755
 
757 756
             x2 <- I.readIORef ref
758  
-            x2 @?= 0
  757
+            x2 `shouldBe` 0
759 758
 
760 759
             final
761 760
 
762 761
             x3 <- I.readIORef ref
763  
-            x3 @?= 1
  762
+            x3 `shouldBe` 1
764 763
 
765 764
 it' :: String -> IO () -> Spec
766 765
 it' = it
1  filesystem-conduit/filesystem-conduit.cabal
@@ -38,7 +38,6 @@ test-suite test
38 38
     build-depends:   conduit
39 39
                    , base
40 40
                    , hspec == 1.3.*
41  
-                   , HUnit
42 41
                    , QuickCheck
43 42
                    , bytestring
44 43
                    , blaze-builder
1  filesystem-conduit/test/main.hs
@@ -3,7 +3,6 @@
3 3
 import Test.Hspec
4 4
 {-
5 5
 import Test.Hspec.QuickCheck (prop)
6  
-import Test.HUnit
7 6
 
8 7
 import qualified Data.Conduit as C
9 8
 import qualified Data.Conduit.List as CL
1  http-conduit-parsers/http-conduit-parsers.cabal
@@ -27,7 +27,6 @@ test-suite test
27 27
                    , http-conduit-parsers
28 28
                    , base
29 29
                    , hspec == 1.3.*
30  
-                   , HUnit
31 30
                    , bytestring
32 31
     ghc-options:     -Wall
33 32
 
9  http-conduit-parsers/test/main.hs
@@ -4,7 +4,6 @@ import Data.Conduit.List (consume, sinkNull)
4 4
 import Data.Conduit.HTTP
5 5
 
6 6
 import Test.Hspec
7  
-import Test.HUnit
8 7
 import Data.ByteString.Char8 ()
9 8
 import qualified Data.ByteString.Lazy.Char8 as L
10 9
 import Control.Exception (try)
@@ -14,7 +13,7 @@ main = hspec $ do
14 13
     describe "headerLines" $ do
15 14
         it "works" $ do
16 15
             x <- mapM_ yield ["foo\r\n", "bar\r", "\nbaz\r\n\r\nbin\r\n"] $$ headerLines 1000 =$ consume
17  
-            x @?= ["foo", "bar", "baz"]
  16
+            x `shouldBe` ["foo", "bar", "baz"]
18 17
         it "overlargeheader" $ do
19 18
             x <- try $ mapM_ yield ["foo\r\n", "bar\r", "\nbaz\r\n\r\nbin\r\n"] $$ headerLines 5 =$ consume
20 19
             case x of
@@ -27,12 +26,12 @@ main = hspec $ do
27 26
                 _ -> error $ show x
28 27
         it "multiline" $ do
29 28
             x <- mapM_ yield ["foo\r\n", " foo2\r\nbar\r", "\n\tbar2\r\nbaz\r\n\r\nbin\r\n"] $$ headerLines 1000 =$ consume
30  
-            x @?= ["foo foo2", "bar\tbar2", "baz"]
  29
+            x `shouldBe` ["foo foo2", "bar\tbar2", "baz"]
31 30
         it "body remains" $ do
32 31
             x <- mapM_ yield ["foo\r\n", " foo2\r\nbar\r", "\n\tbar2\r\nbaz\r\n\r\nbin\r\n"] $$ do
33 32
                 headerLines 1000 =$ sinkNull
34 33
                 consume
35  
-            L.fromChunks x @?= "bin\r\n"
  34
+            L.fromChunks x `shouldBe` "bin\r\n"
36 35
         it "doesn't consume too much" $ do
37 36
             x <- mapM_ yield ["foo\r\n", "bar\r", "\nbaz\r\n\r\n", error "too much"] $$ headerLines 1000 =$ consume
38  
-            x @?= ["foo", "bar", "baz"]
  37
+            x `shouldBe` ["foo", "bar", "baz"]
1  imagesize-conduit/imagesize-conduit.cabal
@@ -30,7 +30,6 @@ test-suite test
30 30
                    , imagesize-conduit
31 31
                    , base
32 32
                    , hspec == 1.3.*
33  
-                   , HUnit
34 33
                    , bytestring
35 34
     ghc-options:     -Wall
36 35
 
5  imagesize-conduit/test/main.hs
@@ -4,7 +4,6 @@ import qualified Data.Conduit.Binary as CB
4 4
 import Data.Conduit.ImageSize
5 5
 
6 6
 import Test.Hspec
7  
-import Test.HUnit
8 7
 
9 8
 main :: IO ()
10 9
 main = hspec $ do
@@ -14,7 +13,7 @@ main = hspec $ do
14 13
         it "gif" $ check (Just $ Size 271 61) "test/logo.gif"
15 14
         it "invalid" $ check Nothing "test/main.hs"
16 15
 
17  
-check :: Maybe Size -> FilePath -> Assertion
  16
+check :: Maybe Size -> FilePath -> Expectation
18 17
 check ex fp = do
19 18
     size <- C.runResourceT $ CB.sourceFile fp C.$$ sinkImageSize
20  
-    size @?= ex
  19
+    size `shouldBe` ex
3  zlib-conduit/test/main.hs
... ...
@@ -1,6 +1,5 @@
1 1
 import Test.Hspec
2 2
 import Test.Hspec.QuickCheck (prop)
3  
-import Test.HUnit
4 3
 
5 4
 import qualified Data.Conduit as C
6 5
 import qualified Data.Conduit.List as CL
@@ -37,4 +36,4 @@ main = hspec $ do
37 36
             let unChunk (C.Chunk x) = [x]
38 37
                 unChunk C.Flush = []
39 38
             bss <- CL.sourceList bssC C.$$ CL.concatMap unChunk C.=$ CZ.ungzip C.=$ CL.consume
40  
-            L.fromChunks bss @?= content
  39
+            L.fromChunks bss `shouldBe` content
1  zlib-conduit/zlib-conduit.cabal
@@ -33,7 +33,6 @@ test-suite test
33 33
     build-depends:   conduit
34 34
                    , base
35 35
                    , hspec == 1.3.*
36  
-                   , HUnit
37 36
                    , QuickCheck
38 37
                    , bytestring
39 38
                    , transformers

0 notes on commit a1dd86c

Please sign in to comment.
Something went wrong with that request. Please try again.