caster 0.0.2.0 → 0.0.2.1
raw patch · 3 files changed
+25/−6 lines, 3 filesdep ~stmPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: stm
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- caster.cabal +3/−1
- test/CasterTest.hs +16/−5
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Change Log +## [0.0.2 -- 2019-05-04]++### Added++- Color logs for terminal.+ ## [0.0.1 -- 2019-04-13] ### Added
caster.cabal view
@@ -1,5 +1,5 @@ name: caster-version: 0.0.2.0+version: 0.0.2.1 synopsis: Multicast, thread-safe, and fast logger. description: Please see the README on GitHub at <https://github.com/kirisaki/caster#readme> homepage: https://github.com/kirisaki/caster#readme@@ -44,6 +44,7 @@ default-language: Haskell2010 hs-source-dirs: test+ default-extensions: LambdaCase build-depends: base >= 4 && < 5 , caster@@ -53,6 +54,7 @@ , fast-builder , QuickCheck , quickcheck-instances+ , stm , tasty-hunit , tasty , tasty-discover
test/CasterTest.hs view
@@ -9,6 +9,7 @@ import Test.Tasty.QuickCheck import Control.Concurrent+import Control.Concurrent.STM import Control.Monad import qualified Data.ByteString as SBS import qualified Data.ByteString.Builder as BB@@ -57,7 +58,8 @@ prop_broadcastLog msgs = monadicIO $ do result <- run $ do chan <- newLogChan- lq <- newLogQueue+ LogQueue lq' <- newLogQueue+ let lq = LogQueue lq' (file0, handle0) <- openTempFile "/tmp" "caster_test_0.log" let listener0 = handleListenerFlush defaultFormatter handle0@@ -74,11 +76,16 @@ threadb <- forkIO $ broadcastLog lq chan mapM_ (uncurry $ logAs lq) msgs+ atomically $ wait lq' - log0 <- hGetContents handle0- log1 <- hGetContents handle1- log2 <- hGetContents handle2+ hClose handle0+ hClose handle1+ hClose handle2 + log0 <- SBS.readFile file0+ log1 <- SBS.readFile file1+ log2 <- SBS.readFile file2+ let !res = log0 == log1 && log1 == log2 killThread thread0@@ -86,13 +93,17 @@ killThread thread2 killThread threadb + removeFile file0 removeFile file1 removeFile file2 pure res- QCM.assert result+ where+ wait q = tryPeekTQueue q >>= \case+ Just _ -> wait q+ Nothing -> pure () unit_stdout :: IO () unit_stdout = testListenrWith stdoutListener