on master help sign in
Prefix tests with module names
ac5c311Adithya Kumar
test/Streamly/Test/Common/Array.hs+14
@@ -48,6 +48,19 @@ import qualified Streamly.Internal.Data.Array as A
48type Array = A.Array
48type Array = A.Array
49#endif
49#endif
50
50
51+moduleName :: String
52+#ifdef TEST_SMALL_ARRAY
53+moduleName = "Data.SmallArray"
54+#elif defined(TEST_ARRAY)
55+moduleName = "Data.Array.Foreign"
56+#elif defined(DATA_ARRAY_PRIM_PINNED)
57+moduleName = "Data.Array.Prim.Pinned"
58+#elif defined(DATA_ARRAY_PRIM)
59+moduleName = "Data.Array.Prim"
60+#else
61+moduleName = "Data.Array"
62+#endif
63+
51-- Coverage build takes too long with default number of tests
64-- Coverage build takes too long with default number of tests
52maxTestCount :: Int
65maxTestCount :: Int
53#ifdef DEVBUILD
66#ifdef DEVBUILD
@@ -213,6 +226,7 @@ main =
213 hspec $
226 hspec $
214 H.parallel $
227 H.parallel $
215 modifyMaxSuccess (const maxTestCount) $ do
228 modifyMaxSuccess (const maxTestCount) $ do
229+ describe moduleName $ do
216 describe "Construction" $ do
230 describe "Construction" $ do
217 prop "length . writeN n === n" testLength
231 prop "length . writeN n === n" testLength
218 prop "length . fromStreamN n === n" testLengthFromStreamN
232 prop "length . fromStreamN n === n" testLengthFromStreamN
test/Streamly/Test/Data/Fold.hs+5−2
@@ -444,9 +444,12 @@ headAndRest ls = monadicIO $ do
444 taill [] = []
444 taill [] = []
445 taill (_:xs) = xs
445 taill (_:xs) = xs
446
446
447+moduleName :: String
448+moduleName = "Data.Fold"
449+
447main :: IO ()
450main :: IO ()
448main = hspec $ do
451main = hspec $ do
449− describe "Fold" $ do
452+ describe moduleName $ do
450 -- Folds
453 -- Folds
451 -- Accumulators
454 -- Accumulators
452 prop "mconcat" Main.mconcat
455 prop "mconcat" Main.mconcat
@@ -523,5 +526,5 @@ main = hspec $ do
523 prop "many" Main.many
526 prop "many" Main.many
524 -- concatMap
527 -- concatMap
525 -- chunksOf
528 -- chunksOf
526− describe "FoldAndReturn s" $ do
529+
527 prop "head from fold_" headAndRest
530 prop "head from fold_" headAndRest
test/Streamly/Test/Data/List.hs+9−1
@@ -31,8 +31,16 @@ infixr 5 `Cons`
31{-# COMPLETE Nil, Cons #-}
31{-# COMPLETE Nil, Cons #-}
32#endif
32#endif
33
33
34+moduleName :: String
35+#ifdef USE_STREAMLY_LIST
36+moduleName = "Data.List+Data.List.Base"
37+#else
38+moduleName = "Data.List.Base"
39+#endif
40+
34main :: IO ()
41main :: IO ()
35−main = hspec $ do
42+main = hspec $
43+ describe moduleName $ do
36#ifdef USE_STREAMLY_LIST
44#ifdef USE_STREAMLY_LIST
37 describe "OverloadedLists for 'SerialT Identity' type" $ do
45 describe "OverloadedLists for 'SerialT Identity' type" $ do
38 it "Overloaded lists" $ do
46 it "Overloaded lists" $ do
test/Streamly/Test/Data/Parser.hs+8−3
@@ -684,11 +684,16 @@ manyEqParseMany =
684-- Main
684-- Main
685-------------------------------------------------------------------------------
685-------------------------------------------------------------------------------
686
686
687+moduleName :: String
688+moduleName = "Data.Parser"
689+
687main :: IO ()
690main :: IO ()
688main =
691main =
689− hspec $
692+ hspec $
690− H.parallel $
693+ H.parallel $
691− modifyMaxSuccess (const maxTestCount) $ do
694+ modifyMaxSuccess (const maxTestCount) $ do
695+ describe moduleName $ do
696+
692 describe "Instances" $ do
697 describe "Instances" $ do
693 prop "applicative" applicative
698 prop "applicative" applicative
694 prop "monad" monad
699 prop "monad" monad
test/Streamly/Test/Data/Parser/ParserD.hs+8−3
@@ -701,11 +701,16 @@ parseMany2Events =
701-- Main
701-- Main
702-------------------------------------------------------------------------------
702-------------------------------------------------------------------------------
703
703
704+moduleName :: String
705+moduleName = "Data.Parser.ParserD"
706+
704main :: IO ()
707main :: IO ()
705main =
708main =
706− hspec $
709+ hspec $
707− H.parallel $
710+ H.parallel $
708− modifyMaxSuccess (const maxTestCount) $ do
711+ modifyMaxSuccess (const maxTestCount) $ do
712+ describe moduleName $ do
713+
709 describe "Instances" $ do
714 describe "Instances" $ do
710 prop "applicative" applicative
715 prop "applicative" applicative
711 prop "monad" monad
716 prop "monad" monad
test/Streamly/Test/Data/Unfold.hs+4−1
@@ -434,10 +434,13 @@ testCombination =
434-- Main
434-- Main
435-------------------------------------------------------------------------------
435-------------------------------------------------------------------------------
436
436
437+moduleName :: String
438+moduleName = "Data.Unfold"
439+
437main :: IO ()
440main :: IO ()
438main =
441main =
439 hspec
442 hspec
440− $ describe "Unfold tests"
443+ $ describe moduleName
441 $ do
444 $ do
442 testInputOps
445 testInputOps
443 testGeneration
446 testGeneration
test/Streamly/Test/FileSystem/Event.hs+4−1
@@ -393,7 +393,10 @@ testDesc =
393 )
393 )
394 ]
394 ]
395
395
396+moduleName :: String
397+moduleName = "FileSystem.Event"
398+
396main :: IO ()
399main :: IO ()
397main = do
400main = do
398 hSetBuffering stdout NoBuffering
401 hSetBuffering stdout NoBuffering
399− hspec $ sequence_ $ map driver testDesc
402+ hspec $ describe moduleName $ sequence_ $ map driver testDesc
test/Streamly/Test/FileSystem/Handle.hs+4
@@ -152,11 +152,15 @@ testWriteWithChunk =
152 let arr = Array.fromList ls
152 let arr = Array.fromList ls
153 return (testDataLarge == utf8ToString arr)
153 return (testDataLarge == utf8ToString arr)
154
154
155+moduleName :: String
156+moduleName = "FileSystem.Handle"
157+
155main :: IO ()
158main :: IO ()
156main =
159main =
157 hspec $
160 hspec $
158 H.parallel $
161 H.parallel $
159 modifyMaxSuccess (const maxTestCount) $ do
162 modifyMaxSuccess (const maxTestCount) $ do
163+ describe moduleName $ do
160 describe "Read From Handle" $ do
164 describe "Read From Handle" $ do
161 prop "read" $ testRead readFromHandle
165 prop "read" $ testRead readFromHandle
162 prop "readWithBufferOf" $ testRead readWithBufferFromHandle
166 prop "readWithBufferOf" $ testRead readWithBufferFromHandle
test/Streamly/Test/Network/Inet/TCP.hs+4
@@ -124,9 +124,13 @@ validateOnPortLocal = monadicIO $ do
124 Stream.eqBy (==) (Stream.fromList dataChunk) ls2
124 Stream.eqBy (==) (Stream.fromList dataChunk) ls2
125 assert res
125 assert res
126
126
127+moduleName :: String
128+moduleName = "Network.Inet.TCP"
129+
127main :: IO ()
130main :: IO ()
128main = hspec $ do
131main = hspec $ do
129 modifyMaxSuccess (const 1) $ do
132 modifyMaxSuccess (const 1) $ do
133+ describe moduleName $ do
130 describe "Accept Connections" $ do
134 describe "Accept Connections" $ do
131 prop "acceptOnPort" validateOnPort
135 prop "acceptOnPort" validateOnPort
132 prop "acceptOnPortLocal" validateOnPortLocal
136 prop "acceptOnPortLocal" validateOnPortLocal
test/Streamly/Test/Network/Socket.hs+4
@@ -137,9 +137,13 @@ validateChunksWithBufferOf = monadicIO $ do
137 Stream.eqBy (==) (Stream.fromList testDataSource) ls2
137 Stream.eqBy (==) (Stream.fromList testDataSource) ls2
138 assert res
138 assert res
139
139
140+moduleName :: String
141+moduleName = "Network.Socket"
142+
140main :: IO ()
143main :: IO ()
141main = hspec $ do
144main = hspec $ do
142 modifyMaxSuccess (const 1) $ do
145 modifyMaxSuccess (const 1) $ do
146+ describe moduleName $ do
143 describe "Read/Write" $ do
147 describe "Read/Write" $ do
144 prop "read/write" validateRW
148 prop "read/write" validateRW
145 prop "readWithBufferOf/writeWithBufferOf" validateWithBufferOf
149 prop "readWithBufferOf/writeWithBufferOf" validateWithBufferOf
test/Streamly/Test/Prelude.hs+3
@@ -169,9 +169,12 @@ parallelLoops = do
169 >> print rnd
169 >> print rnd
170 return (name, rnd) `S.parallel` loop name
170 return (name, rnd) `S.parallel` loop name
171
171
172+moduleName :: String
173+moduleName = "Prelude"
172
174
173main :: IO ()
175main :: IO ()
174main = hspec $ H.parallel $ do
176main = hspec $ H.parallel $ do
177+ describe moduleName $ do
175 describe "Miscellaneous combined examples" mixedOps
178 describe "Miscellaneous combined examples" mixedOps
176 describe "Miscellaneous combined examples aheadly" mixedOpsAheadly
179 describe "Miscellaneous combined examples aheadly" mixedOpsAheadly
177 describe "Simple MonadError and MonadThrow" simpleMonadError
180 describe "Simple MonadError and MonadThrow" simpleMonadError
test/Streamly/Test/Prelude/Ahead.hs+6−3
@@ -40,13 +40,16 @@ associativityCheck desc t = prop desc assocCheckProp
40 assocStream <- run $ S.toList $ t $ xStream <> yStream <> zStream
40 assocStream <- run $ S.toList $ t $ xStream <> yStream <> zStream
41 listEquals (==) infixAssocstream assocStream
41 listEquals (==) infixAssocstream assocStream
42
42
43+moduleName :: String
44+moduleName = "Prelude.Ahead"
45+
43main :: IO ()
46main :: IO ()
44main = hspec
47main = hspec
45− $ H.parallel
48+ $ H.parallel
46#ifdef COVERAGE_BUILD
49#ifdef COVERAGE_BUILD
47− $ modifyMaxSuccess (const 10)
50+ $ modifyMaxSuccess (const 10)
48#endif
51#endif
49− $ do
52+ $ describe moduleName $ do
50 let aheadOps :: IsStream t => ((AheadT IO a -> t IO a) -> Spec) -> Spec
53 let aheadOps :: IsStream t => ((AheadT IO a -> t IO a) -> Spec) -> Spec
51 aheadOps spec = mapOps spec $ makeOps S.aheadly
54 aheadOps spec = mapOps spec $ makeOps S.aheadly
52#ifndef COVERAGE_BUILD
55#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Async.hs+6−3
@@ -21,13 +21,16 @@ import qualified Streamly.Prelude as S
21
21
22import Streamly.Test.Prelude.Common
22import Streamly.Test.Prelude.Common
23
23
24+moduleName :: String
25+moduleName = "Prelude.Ahead"
26+
24main :: IO ()
27main :: IO ()
25main = hspec
28main = hspec
26− $ H.parallel
29+ $ H.parallel
27#ifdef COVERAGE_BUILD
30#ifdef COVERAGE_BUILD
28− $ modifyMaxSuccess (const 10)
31+ $ modifyMaxSuccess (const 10)
29#endif
32#endif
30− $ do
33+ $ describe moduleName $ do
31 let asyncOps :: IsStream t => ((AsyncT IO a -> t IO a) -> Spec) -> Spec
34 let asyncOps :: IsStream t => ((AsyncT IO a -> t IO a) -> Spec) -> Spec
32 asyncOps spec = mapOps spec $ makeOps asyncly
35 asyncOps spec = mapOps spec $ makeOps asyncly
33#ifndef COVERAGE_BUILD
36#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Concurrent.hs+6−3
@@ -323,13 +323,16 @@ takeInfinite t =
323 S.drain (t $ S.take 1 $ S.repeatM (print "hello" >> return (1::Int)))
323 S.drain (t $ S.take 1 $ S.repeatM (print "hello" >> return (1::Int)))
324 `shouldReturn` ()
324 `shouldReturn` ()
325
325
326+moduleName :: String
327+moduleName = "Prelude.Concurrent"
328+
326main :: IO ()
329main :: IO ()
327main = hspec
330main = hspec
328− $ H.parallel
331+ $ H.parallel
329#ifdef COVERAGE_BUILD
332#ifdef COVERAGE_BUILD
330− $ modifyMaxSuccess (const 10)
333+ $ modifyMaxSuccess (const 10)
331#endif
334#endif
332− $ do
335+ $ describe moduleName $ do
333 -- We can have these in Test.Prelude, but I think it's unnecessary.
336 -- We can have these in Test.Prelude, but I think it's unnecessary.
334 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
337 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
335 serialOps spec = mapOps spec $ makeOps serially
338 serialOps spec = mapOps spec $ makeOps serially
test/Streamly/Test/Prelude/Fold.hs+7−3
@@ -142,13 +142,17 @@ checkFoldrLaziness = do
142 $ (S.fromList (2:4:5:undefined) :: SerialT IO Int))
142 $ (S.fromList (2:4:5:undefined) :: SerialT IO Int))
143 `shouldReturn` [True]
143 `shouldReturn` [True]
144
144
145+moduleName :: String
146+moduleName = "Prelude.Fold"
147+
145main :: IO ()
148main :: IO ()
146main = hspec
149main = hspec
147− $ H.parallel
150+ $ H.parallel
148#ifdef COVERAGE_BUILD
151#ifdef COVERAGE_BUILD
149− $ modifyMaxSuccess (const 10)
152+ $ modifyMaxSuccess (const 10)
150#endif
153#endif
151− $ do
154+ $ describe moduleName $ do
155+
152 ---------------------------------------------------------------------------
156 ---------------------------------------------------------------------------
153 -- Left folds are strict enough
157 -- Left folds are strict enough
154 ---------------------------------------------------------------------------
158 ---------------------------------------------------------------------------
test/Streamly/Test/Prelude/Parallel.hs+6−3
@@ -21,13 +21,16 @@ import qualified Streamly.Prelude as S
21
21
22import Streamly.Test.Prelude.Common
22import Streamly.Test.Prelude.Common
23
23
24+moduleName :: String
25+moduleName = "Prelude.Parallel"
26+
24main :: IO ()
27main :: IO ()
25main = hspec
28main = hspec
26− $ H.parallel
29+ $ H.parallel
27#ifdef COVERAGE_BUILD
30#ifdef COVERAGE_BUILD
28− $ modifyMaxSuccess (const 10)
31+ $ modifyMaxSuccess (const 10)
29#endif
32#endif
30− $ do
33+ $ describe moduleName $ do
31 let
34 let
32#ifndef COVERAGE_BUILD
35#ifndef COVERAGE_BUILD
33 parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
36 parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
test/Streamly/Test/Prelude/Rate.hs+4
@@ -140,8 +140,12 @@ measureBuffers desc t buffers count = do
140 duration = (expectedTime * 0.9, expectedTime * 1.1)
140 duration = (expectedTime * 0.9, expectedTime * 1.1)
141 measureRate' desc t buffers (-1) (Right count) 0 (1,1) duration
141 measureRate' desc t buffers (-1) (Right count) 0 (1,1) duration
142
142
143+moduleName :: String
144+moduleName = "Prelude.Rate"
145+
143main :: IO ()
146main :: IO ()
144main = hspec $ do
147main = hspec $ do
148+ describe moduleName $ do
145
149
146 describe "maxBuffers" $ do
150 describe "maxBuffers" $ do
147 measureBuffers "asyncly" asyncly (-1) 5
151 measureBuffers "asyncly" asyncly (-1) 5
test/Streamly/Test/Prelude/Serial.hs+6−3
@@ -502,13 +502,16 @@ foldIterateM =
502 Nothing -> assert $ s1 == 0
502 Nothing -> assert $ s1 == 0
503 Just s2 -> assert $ s1 == s2
503 Just s2 -> assert $ s1 == s2
504
504
505+moduleName :: String
506+moduleName = "Prelude.Serial"
507+
505main :: IO ()
508main :: IO ()
506main = hspec
509main = hspec
507− $ H.parallel
510+ $ H.parallel
508#ifdef COVERAGE_BUILD
511#ifdef COVERAGE_BUILD
509− $ modifyMaxSuccess (const 10)
512+ $ modifyMaxSuccess (const 10)
510#endif
513#endif
511− $ do
514+ $ describe moduleName $ do
512 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
515 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
513 serialOps spec = mapOps spec $ makeOps serially
516 serialOps spec = mapOps spec $ makeOps serially
514#ifndef COVERAGE_BUILD
517#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/WAsync.hs+6−3
@@ -24,13 +24,16 @@ import qualified Streamly.Prelude as S
24
24
25import Streamly.Test.Prelude.Common
25import Streamly.Test.Prelude.Common
26
26
27+moduleName :: String
28+moduleName = "Prelude.WAsync"
29+
27main :: IO ()
30main :: IO ()
28main = hspec
31main = hspec
29− $ H.parallel
32+ $ H.parallel
30#ifdef COVERAGE_BUILD
33#ifdef COVERAGE_BUILD
31− $ modifyMaxSuccess (const 10)
34+ $ modifyMaxSuccess (const 10)
32#endif
35#endif
33− $ do
36+ $ describe moduleName $ do
34 let wAsyncOps :: IsStream t => ((WAsyncT IO a -> t IO a) -> Spec) -> Spec
37 let wAsyncOps :: IsStream t => ((WAsyncT IO a -> t IO a) -> Spec) -> Spec
35 wAsyncOps spec = mapOps spec $ makeOps wAsyncly
38 wAsyncOps spec = mapOps spec $ makeOps wAsyncly
36#ifndef COVERAGE_BUILD
39#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/WSerial.hs+6−3
@@ -68,13 +68,16 @@ wSerialMinLengthProp =
68 infiniteStream = S.repeat 1
68 infiniteStream = S.repeat 1
69 combined len = infiniteStream `Serial.wSerialMin` finiteStream len
69 combined len = infiniteStream `Serial.wSerialMin` finiteStream len
70
70
71+moduleName :: String
72+moduleName = "Prelude.WSerial"
73+
71main :: IO ()
74main :: IO ()
72main = hspec
75main = hspec
73− $ H.parallel
76+ $ H.parallel
74#ifdef COVERAGE_BUILD
77#ifdef COVERAGE_BUILD
75− $ modifyMaxSuccess (const 10)
78+ $ modifyMaxSuccess (const 10)
76#endif
79#endif
77− $ do
80+ $ describe moduleName $ do
78 let wSerialOps :: IsStream t => ((WSerialT IO a -> t IO a) -> Spec) -> Spec
81 let wSerialOps :: IsStream t => ((WSerialT IO a -> t IO a) -> Spec) -> Spec
79 wSerialOps spec = mapOps spec $ makeOps wSerially
82 wSerialOps spec = mapOps spec $ makeOps wSerially
80#ifndef COVERAGE_BUILD
83#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/ZipAsync.hs+6−3
@@ -17,13 +17,16 @@ import qualified Streamly.Prelude as S
17
17
18import Streamly.Test.Prelude.Common
18import Streamly.Test.Prelude.Common
19
19
20+moduleName :: String
21+moduleName = "Prelude.ZipAsync"
22+
20main :: IO ()
23main :: IO ()
21main = hspec
24main = hspec
22− $ H.parallel
25+ $ H.parallel
23#ifdef COVERAGE_BUILD
26#ifdef COVERAGE_BUILD
24− $ modifyMaxSuccess (const 10)
27+ $ modifyMaxSuccess (const 10)
25#endif
28#endif
26− $ do
29+ $ describe moduleName $ do
27 -- Note, the "pure" of applicative Zip streams generates and infinite
30 -- Note, the "pure" of applicative Zip streams generates and infinite
28 -- stream and therefore maxBuffer (-1) must not be used for that case.
31 -- stream and therefore maxBuffer (-1) must not be used for that case.
29 let zipAsyncOps :: IsStream t => ((ZipAsyncM IO a -> t IO a) -> Spec) -> Spec
32 let zipAsyncOps :: IsStream t => ((ZipAsyncM IO a -> t IO a) -> Spec) -> Spec
test/Streamly/Test/Prelude/ZipSerial.hs+6−3
@@ -20,13 +20,16 @@ import qualified Streamly.Prelude as S
20
20
21import Streamly.Test.Prelude.Common
21import Streamly.Test.Prelude.Common
22
22
23+moduleName :: String
24+moduleName = "Prelude.ZipSerial"
25+
23main :: IO ()
26main :: IO ()
24main = hspec
27main = hspec
25− $ H.parallel
28+ $ H.parallel
26#ifdef COVERAGE_BUILD
29#ifdef COVERAGE_BUILD
27− $ modifyMaxSuccess (const 10)
30+ $ modifyMaxSuccess (const 10)
28#endif
31#endif
29− $ do
32+ $ describe moduleName $ do
30 let zipSerialOps :: IsStream t
33 let zipSerialOps :: IsStream t
31 => ((ZipSerialM IO a -> t IO a) -> Spec) -> Spec
34 => ((ZipSerialM IO a -> t IO a) -> Spec) -> Spec
32 zipSerialOps spec = mapOps spec $ makeOps zipSerially
35 zipSerialOps spec = mapOps spec $ makeOps zipSerially
test/Streamly/Test/Unicode/Stream.hs+6−3
@@ -156,11 +156,14 @@ testUnwords =
156 $ S.fromList list
156 $ S.fromList list
157 assert (xs == unwords (words list))
157 assert (xs == unwords (words list))
158
158
159+moduleName :: String
160+moduleName = "Unicode.Stream"
161+
159main :: IO ()
162main :: IO ()
160main = H.hspec
163main = H.hspec
161− $ H.parallel
164+ $ H.parallel
162− $ modifyMaxSuccess (const 1000)
165+ $ modifyMaxSuccess (const 1000)
163− $ do
166+ $ H.describe moduleName $ do
164 H.describe "UTF8 - Encoding / Decoding" $ do
167 H.describe "UTF8 - Encoding / Decoding" $ do
165 prop "decodeUtf8' . encodeUtf8' == id" propDecodeEncodeId'
168 prop "decodeUtf8' . encodeUtf8' == id" propDecodeEncodeId'
166 prop "decodeUtf8 . encodeUtf8' == id" propDecodeEncodeId
169 prop "decodeUtf8 . encodeUtf8' == id" propDecodeEncodeId