on master help sign in
Prefix tests with module names

Solves https://github.com/composewell/streamly/issues/858

commitac5c3112429c923b075705450d1b588bf3e5eb19 authorAdithya Kumar <adithya@composewell.com> dateWed 31 Mar 2021, 03:09 (6 years ago) parentf1f8d7a
23 files changed+138−44
test/Streamly/Test/Common/Array.hs+14 test/Streamly/Test/Data/Fold.hs+5−2 test/Streamly/Test/Data/List.hs+9−1 test/Streamly/Test/Data/Parser.hs+8−3 test/Streamly/Test/Data/Parser/ParserD.hs+8−3 test/Streamly/Test/Data/Unfold.hs+4−1 test/Streamly/Test/FileSystem/Event.hs+4−1 test/Streamly/Test/FileSystem/Handle.hs+4 test/Streamly/Test/Network/Inet/TCP.hs+4 test/Streamly/Test/Network/Socket.hs+4 test/Streamly/Test/Prelude.hs+3 test/Streamly/Test/Prelude/Ahead.hs+6−3 test/Streamly/Test/Prelude/Async.hs+6−3 test/Streamly/Test/Prelude/Concurrent.hs+6−3 test/Streamly/Test/Prelude/Fold.hs+7−3 test/Streamly/Test/Prelude/Parallel.hs+6−3 test/Streamly/Test/Prelude/Rate.hs+4 test/Streamly/Test/Prelude/Serial.hs+6−3 test/Streamly/Test/Prelude/WAsync.hs+6−3 test/Streamly/Test/Prelude/WSerial.hs+6−3 test/Streamly/Test/Prelude/ZipAsync.hs+6−3 test/Streamly/Test/Prelude/ZipSerial.hs+6−3 test/Streamly/Test/Unicode/Stream.hs+6−3
test/Streamly/Test/Common/Array.hs+14
@@ -48,6 +48,19 @@ import qualified Streamly.Internal.Data.Array as A
4848type Array = A.Array
4949#endif
5050
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+
5164-- Coverage build takes too long with default number of tests
5265maxTestCount :: Int
5366#ifdef DEVBUILD
@@ -213,6 +226,7 @@ main =
213226 hspec $
214227 H.parallel $
215228 modifyMaxSuccess (const maxTestCount) $ do
229+ describe moduleName $ do
216230 describe "Construction" $ do
217231 prop "length . writeN n === n" testLength
218232 prop "length . fromStreamN n === n" testLengthFromStreamN
test/Streamly/Test/Data/Fold.hs+5−2
@@ -444,9 +444,12 @@ headAndRest ls = monadicIO $ do
444444 taill [] = []
445445 taill (_:xs) = xs
446446
447+moduleName :: String
448+moduleName = "Data.Fold"
449+
447450main :: IO ()
448451main = hspec $ do
449− describe "Fold" $ do
452+ describe moduleName $ do
450453 -- Folds
451454 -- Accumulators
452455 prop "mconcat" Main.mconcat
@@ -523,5 +526,5 @@ main = hspec $ do
523526 prop "many" Main.many
524527 -- concatMap
525528 -- chunksOf
526− describe "FoldAndReturn s" $ do
529+
527530 prop "head from fold_" headAndRest
test/Streamly/Test/Data/List.hs+9−1
@@ -31,8 +31,16 @@ infixr 5 `Cons`
3131{-# COMPLETE Nil, Cons #-}
3232#endif
3333
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+
3441main :: IO ()
35−main = hspec $ do
42+main = hspec $
43+ describe moduleName $ do
3644#ifdef USE_STREAMLY_LIST
3745 describe "OverloadedLists for 'SerialT Identity' type" $ do
3846 it "Overloaded lists" $ do
test/Streamly/Test/Data/Parser.hs+8−3
@@ -684,11 +684,16 @@ manyEqParseMany =
684684-- Main
685685-------------------------------------------------------------------------------
686686
687+moduleName :: String
688+moduleName = "Data.Parser"
689+
687690main :: IO ()
688691main =
689− hspec $
690− H.parallel $
691− modifyMaxSuccess (const maxTestCount) $ do
692+ hspec $
693+ H.parallel $
694+ modifyMaxSuccess (const maxTestCount) $ do
695+ describe moduleName $ do
696+
692697 describe "Instances" $ do
693698 prop "applicative" applicative
694699 prop "monad" monad
test/Streamly/Test/Data/Parser/ParserD.hs+8−3
@@ -701,11 +701,16 @@ parseMany2Events =
701701-- Main
702702-------------------------------------------------------------------------------
703703
704+moduleName :: String
705+moduleName = "Data.Parser.ParserD"
706+
704707main :: IO ()
705708main =
706− hspec $
707− H.parallel $
708− modifyMaxSuccess (const maxTestCount) $ do
709+ hspec $
710+ H.parallel $
711+ modifyMaxSuccess (const maxTestCount) $ do
712+ describe moduleName $ do
713+
709714 describe "Instances" $ do
710715 prop "applicative" applicative
711716 prop "monad" monad
test/Streamly/Test/Data/Unfold.hs+4−1
@@ -434,10 +434,13 @@ testCombination =
434434-- Main
435435-------------------------------------------------------------------------------
436436
437+moduleName :: String
438+moduleName = "Data.Unfold"
439+
437440main :: IO ()
438441main =
439442 hspec
440− $ describe "Unfold tests"
443+ $ describe moduleName
441444 $ do
442445 testInputOps
443446 testGeneration
test/Streamly/Test/FileSystem/Event.hs+4−1
@@ -393,7 +393,10 @@ testDesc =
393393 )
394394 ]
395395
396+moduleName :: String
397+moduleName = "FileSystem.Event"
398+
396399main :: IO ()
397400main = do
398401 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 =
152152 let arr = Array.fromList ls
153153 return (testDataLarge == utf8ToString arr)
154154
155+moduleName :: String
156+moduleName = "FileSystem.Handle"
157+
155158main :: IO ()
156159main =
157160 hspec $
158161 H.parallel $
159162 modifyMaxSuccess (const maxTestCount) $ do
163+ describe moduleName $ do
160164 describe "Read From Handle" $ do
161165 prop "read" $ testRead readFromHandle
162166 prop "readWithBufferOf" $ testRead readWithBufferFromHandle
test/Streamly/Test/Network/Inet/TCP.hs+4
@@ -124,9 +124,13 @@ validateOnPortLocal = monadicIO $ do
124124 Stream.eqBy (==) (Stream.fromList dataChunk) ls2
125125 assert res
126126
127+moduleName :: String
128+moduleName = "Network.Inet.TCP"
129+
127130main :: IO ()
128131main = hspec $ do
129132 modifyMaxSuccess (const 1) $ do
133+ describe moduleName $ do
130134 describe "Accept Connections" $ do
131135 prop "acceptOnPort" validateOnPort
132136 prop "acceptOnPortLocal" validateOnPortLocal
test/Streamly/Test/Network/Socket.hs+4
@@ -137,9 +137,13 @@ validateChunksWithBufferOf = monadicIO $ do
137137 Stream.eqBy (==) (Stream.fromList testDataSource) ls2
138138 assert res
139139
140+moduleName :: String
141+moduleName = "Network.Socket"
142+
140143main :: IO ()
141144main = hspec $ do
142145 modifyMaxSuccess (const 1) $ do
146+ describe moduleName $ do
143147 describe "Read/Write" $ do
144148 prop "read/write" validateRW
145149 prop "readWithBufferOf/writeWithBufferOf" validateWithBufferOf
test/Streamly/Test/Prelude.hs+3
@@ -169,9 +169,12 @@ parallelLoops = do
169169 >> print rnd
170170 return (name, rnd) `S.parallel` loop name
171171
172+moduleName :: String
173+moduleName = "Prelude"
172174
173175main :: IO ()
174176main = hspec $ H.parallel $ do
177+ describe moduleName $ do
175178 describe "Miscellaneous combined examples" mixedOps
176179 describe "Miscellaneous combined examples aheadly" mixedOpsAheadly
177180 describe "Simple MonadError and MonadThrow" simpleMonadError
test/Streamly/Test/Prelude/Ahead.hs+6−3
@@ -40,13 +40,16 @@ associativityCheck desc t = prop desc assocCheckProp
4040 assocStream <- run $ S.toList $ t $ xStream <> yStream <> zStream
4141 listEquals (==) infixAssocstream assocStream
4242
43+moduleName :: String
44+moduleName = "Prelude.Ahead"
45+
4346main :: IO ()
4447main = hspec
45− $ H.parallel
48+ $ H.parallel
4649#ifdef COVERAGE_BUILD
47− $ modifyMaxSuccess (const 10)
50+ $ modifyMaxSuccess (const 10)
4851#endif
49− $ do
52+ $ describe moduleName $ do
5053 let aheadOps :: IsStream t => ((AheadT IO a -> t IO a) -> Spec) -> Spec
5154 aheadOps spec = mapOps spec $ makeOps S.aheadly
5255#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Async.hs+6−3
@@ -21,13 +21,16 @@ import qualified Streamly.Prelude as S
2121
2222import Streamly.Test.Prelude.Common
2323
24+moduleName :: String
25+moduleName = "Prelude.Ahead"
26+
2427main :: IO ()
2528main = hspec
26− $ H.parallel
29+ $ H.parallel
2730#ifdef COVERAGE_BUILD
28− $ modifyMaxSuccess (const 10)
31+ $ modifyMaxSuccess (const 10)
2932#endif
30− $ do
33+ $ describe moduleName $ do
3134 let asyncOps :: IsStream t => ((AsyncT IO a -> t IO a) -> Spec) -> Spec
3235 asyncOps spec = mapOps spec $ makeOps asyncly
3336#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Concurrent.hs+6−3
@@ -323,13 +323,16 @@ takeInfinite t =
323323 S.drain (t $ S.take 1 $ S.repeatM (print "hello" >> return (1::Int)))
324324 `shouldReturn` ()
325325
326+moduleName :: String
327+moduleName = "Prelude.Concurrent"
328+
326329main :: IO ()
327330main = hspec
328− $ H.parallel
331+ $ H.parallel
329332#ifdef COVERAGE_BUILD
330− $ modifyMaxSuccess (const 10)
333+ $ modifyMaxSuccess (const 10)
331334#endif
332− $ do
335+ $ describe moduleName $ do
333336 -- We can have these in Test.Prelude, but I think it's unnecessary.
334337 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
335338 serialOps spec = mapOps spec $ makeOps serially
test/Streamly/Test/Prelude/Fold.hs+7−3
@@ -142,13 +142,17 @@ checkFoldrLaziness = do
142142 $ (S.fromList (2:4:5:undefined) :: SerialT IO Int))
143143 `shouldReturn` [True]
144144
145+moduleName :: String
146+moduleName = "Prelude.Fold"
147+
145148main :: IO ()
146149main = hspec
147− $ H.parallel
150+ $ H.parallel
148151#ifdef COVERAGE_BUILD
149− $ modifyMaxSuccess (const 10)
152+ $ modifyMaxSuccess (const 10)
150153#endif
151− $ do
154+ $ describe moduleName $ do
155+
152156 ---------------------------------------------------------------------------
153157 -- Left folds are strict enough
154158 ---------------------------------------------------------------------------
test/Streamly/Test/Prelude/Parallel.hs+6−3
@@ -21,13 +21,16 @@ import qualified Streamly.Prelude as S
2121
2222import Streamly.Test.Prelude.Common
2323
24+moduleName :: String
25+moduleName = "Prelude.Parallel"
26+
2427main :: IO ()
2528main = hspec
26− $ H.parallel
29+ $ H.parallel
2730#ifdef COVERAGE_BUILD
28− $ modifyMaxSuccess (const 10)
31+ $ modifyMaxSuccess (const 10)
2932#endif
30− $ do
33+ $ describe moduleName $ do
3134 let
3235#ifndef COVERAGE_BUILD
3336 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
140140 duration = (expectedTime * 0.9, expectedTime * 1.1)
141141 measureRate' desc t buffers (-1) (Right count) 0 (1,1) duration
142142
143+moduleName :: String
144+moduleName = "Prelude.Rate"
145+
143146main :: IO ()
144147main = hspec $ do
148+ describe moduleName $ do
145149
146150 describe "maxBuffers" $ do
147151 measureBuffers "asyncly" asyncly (-1) 5
test/Streamly/Test/Prelude/Serial.hs+6−3
@@ -502,13 +502,16 @@ foldIterateM =
502502 Nothing -> assert $ s1 == 0
503503 Just s2 -> assert $ s1 == s2
504504
505+moduleName :: String
506+moduleName = "Prelude.Serial"
507+
505508main :: IO ()
506509main = hspec
507− $ H.parallel
510+ $ H.parallel
508511#ifdef COVERAGE_BUILD
509− $ modifyMaxSuccess (const 10)
512+ $ modifyMaxSuccess (const 10)
510513#endif
511− $ do
514+ $ describe moduleName $ do
512515 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
513516 serialOps spec = mapOps spec $ makeOps serially
514517#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/WAsync.hs+6−3
@@ -24,13 +24,16 @@ import qualified Streamly.Prelude as S
2424
2525import Streamly.Test.Prelude.Common
2626
27+moduleName :: String
28+moduleName = "Prelude.WAsync"
29+
2730main :: IO ()
2831main = hspec
29− $ H.parallel
32+ $ H.parallel
3033#ifdef COVERAGE_BUILD
31− $ modifyMaxSuccess (const 10)
34+ $ modifyMaxSuccess (const 10)
3235#endif
33− $ do
36+ $ describe moduleName $ do
3437 let wAsyncOps :: IsStream t => ((WAsyncT IO a -> t IO a) -> Spec) -> Spec
3538 wAsyncOps spec = mapOps spec $ makeOps wAsyncly
3639#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/WSerial.hs+6−3
@@ -68,13 +68,16 @@ wSerialMinLengthProp =
6868 infiniteStream = S.repeat 1
6969 combined len = infiniteStream `Serial.wSerialMin` finiteStream len
7070
71+moduleName :: String
72+moduleName = "Prelude.WSerial"
73+
7174main :: IO ()
7275main = hspec
73− $ H.parallel
76+ $ H.parallel
7477#ifdef COVERAGE_BUILD
75− $ modifyMaxSuccess (const 10)
78+ $ modifyMaxSuccess (const 10)
7679#endif
77− $ do
80+ $ describe moduleName $ do
7881 let wSerialOps :: IsStream t => ((WSerialT IO a -> t IO a) -> Spec) -> Spec
7982 wSerialOps spec = mapOps spec $ makeOps wSerially
8083#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/ZipAsync.hs+6−3
@@ -17,13 +17,16 @@ import qualified Streamly.Prelude as S
1717
1818import Streamly.Test.Prelude.Common
1919
20+moduleName :: String
21+moduleName = "Prelude.ZipAsync"
22+
2023main :: IO ()
2124main = hspec
22− $ H.parallel
25+ $ H.parallel
2326#ifdef COVERAGE_BUILD
24− $ modifyMaxSuccess (const 10)
27+ $ modifyMaxSuccess (const 10)
2528#endif
26− $ do
29+ $ describe moduleName $ do
2730 -- Note, the "pure" of applicative Zip streams generates and infinite
2831 -- stream and therefore maxBuffer (-1) must not be used for that case.
2932 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
2020
2121import Streamly.Test.Prelude.Common
2222
23+moduleName :: String
24+moduleName = "Prelude.ZipSerial"
25+
2326main :: IO ()
2427main = hspec
25− $ H.parallel
28+ $ H.parallel
2629#ifdef COVERAGE_BUILD
27− $ modifyMaxSuccess (const 10)
30+ $ modifyMaxSuccess (const 10)
2831#endif
29− $ do
32+ $ describe moduleName $ do
3033 let zipSerialOps :: IsStream t
3134 => ((ZipSerialM IO a -> t IO a) -> Spec) -> Spec
3235 zipSerialOps spec = mapOps spec $ makeOps zipSerially
test/Streamly/Test/Unicode/Stream.hs+6−3
@@ -156,11 +156,14 @@ testUnwords =
156156 $ S.fromList list
157157 assert (xs == unwords (words list))
158158
159+moduleName :: String
160+moduleName = "Unicode.Stream"
161+
159162main :: IO ()
160163main = H.hspec
161− $ H.parallel
162− $ modifyMaxSuccess (const 1000)
163− $ do
164+ $ H.parallel
165+ $ modifyMaxSuccess (const 1000)
166+ $ H.describe moduleName $ do
164167 H.describe "UTF8 - Encoding / Decoding" $ do
165168 prop "decodeUtf8' . encodeUtf8' == id" propDecodeEncodeId'
166169 prop "decodeUtf8 . encodeUtf8' == id" propDecodeEncodeId