Fix tests under dev flag.

This commit is contained in:
Pranay Sashank 2021-04-05 19:04:23 +05:30
parent 9fc2c7ec15
commit 10b03bf59f
4 changed files with 13 additions and 12 deletions

View File

@ -7,7 +7,7 @@
-- Stability : experimental
-- Portability : GHC
module Streamly.Test.Prelude.MaxRate where
module Streamly.Test.Prelude.Rate where
import qualified Streamly.Prelude as S

View File

@ -427,20 +427,20 @@ checkTakeDropTime (mt0, mt1) = do
return r
#ifdef DEVBUILD
testTakeByTime :: IO Bool
testTakeByTime = do
testTakeInterval :: IO Bool
testTakeInterval = do
r <-
S.fold ((,) <$> FL.head <*> FL.last)
$ IS.takeByTime takeDropTime
S.fold (FL.tee FL.head FL.last)
$ IS.takeInterval takeDropTime
$ S.repeatM (threadDelay 1000 >> getTime Monotonic)
checkTakeDropTime r
testDropByTime :: IO Bool
testDropByTime = do
testDropInterval :: IO Bool
testDropInterval = do
t0 <- getTime Monotonic
mt1 <-
S.head
$ IS.dropByTime takeDropTime
$ IS.dropInterval takeDropTime
$ S.repeatM (threadDelay 1000 >> getTime Monotonic)
checkTakeDropTime (Just t0, mt1)
#endif
@ -633,8 +633,8 @@ main = hspec
#ifdef DEVBUILD
describe "Filtering" $ do
it "takeByTime" (testTakeByTime `shouldReturn` True)
it "dropByTime" (testDropByTime `shouldReturn` True)
it "takeInterval" (testTakeInterval `shouldReturn` True)
it "dropInterval" (testDropInterval `shouldReturn` True)
#endif
describe "Stream group and split operations" $ do

View File

@ -1456,7 +1456,7 @@ bracketPartialStreamProp t vec =
(S.fromList vec))
run $ do
performMajorGC
threadDelay 10000
threadDelay 1000000
refValue <- run $ readIORef ioRef
when (refValue /= 0 && refValue /= 3) $
error $ "refValue == " ++ show refValue
@ -1516,7 +1516,7 @@ finallyPartialStreamProp t vec =
(S.fromList vec))
run $ do
performMajorGC
threadDelay 10000
threadDelay 100000
refValue <- run $ readIORef ioRef
when (refValue /= 0 && refValue /= 2) $
error $ "refValue == " ++ show refValue

View File

@ -179,6 +179,7 @@ common always-optimized
-fdicts-strict
-fmax-worker-args=16
-fspec-constr-recursive=16
-rtsopts
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
ghc-options: -fplugin Fusion.Plugin