packages feed

easytest 0.2 → 0.2.1

raw patch · 5 files changed

+27/−9 lines, 5 filesdep ~basedep ~containerssetup-changedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, containers

API changes (from Hackage documentation)

- EasyTest.Internal: instance Data.Semigroup.Semigroup EasyTest.Internal.Status
+ EasyTest.Internal: instance GHC.Base.Semigroup EasyTest.Internal.Status
- EasyTest.Internal: Env :: TVar StdGen -> [Text] -> TBQueue (Maybe (TMVar ([Text], Status))) -> (Text -> IO ()) -> [Text] -> Env
+ EasyTest.Internal: Env :: TVar StdGen -> [Text] -> TBQueue (Maybe (TMVar ([Text], Status))) -> Text -> IO () -> [Text] -> Env

Files

CHANGES.md view
@@ -1,3 +1,8 @@+## 0.2.1 (10/24/2018)++* [Fix build errors for GHC 8.6](https://github.com/joelburget/easytest/commit/9bb30ec16671c0ec74835a52290b6508143a368f), [prevent building on GHC before 7.10](https://github.com/joelburget/easytest/pull/15/commits/f6d0ac50fa5a351a30b576567306121d67c0973a)+* [Only print emojis for Unicode-capable terminals](https://github.com/joelburget/easytest/commit/e3f12612df46a6367693fd4ad47eedf91c35a079)+ ## 0.2 (3/27/2018)  * [`expectRight` now shows `Left`s. `expectRightNoShow` replicates the old functionality.](https://github.com/joelburget/easytest/commit/c2d5dccc97dcdb925ebc39c36fcde9ff8d894f77)
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
easytest.cabal view
@@ -1,6 +1,6 @@ name:          easytest category:      Testing-version:       0.2+version:       0.2.1 license:       MIT cabal-version: >= 1.8 license-file:  LICENSE@@ -55,7 +55,7 @@ build-type:    Simple extra-source-files: CHANGES.md data-files:-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1, GHC == 8.4.1+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1  source-repository head   type: git@@ -84,9 +84,9 @@   -- these bounds could probably be made looser   build-depends:     async                     >= 2.1      && <= 2.3,-    base                      >= 4.5      && <= 5,+    base                      >= 4.8      && <= 5,     mtl                       >= 2.0.1    && < 2.3,-    containers                >= 0.4.0    && < 0.6,+    containers                >= 0.4.0    && < 0.7,     stm                       >= 2.4      && < 3,     random                    >= 1.1      && < 2,     text                      >= 1.2      && < 1.3,
src/EasyTest/Generators.hs view
@@ -29,6 +29,7 @@ import Control.Monad.IO.Class import Control.Monad.Reader import Data.Map (Map)+import Data.Maybe ( fromJust ) import Data.Word import System.Random (Random) import qualified Data.Map as Map@@ -107,8 +108,8 @@ pick :: [a] -> Test a pick as = let n = length as; ind = picker n as in do   i <- int' 0 (n - 1)-  Just a <- pure (ind i)-  pure a+  a <- pure (ind i)+  pure (fromJust a)             -- TODO: fromJust is not a total function  picker :: Int -> [a] -> (Int -> Maybe a) picker _ [] = const Nothing
src/EasyTest/Porcelain.hs view
@@ -45,6 +45,7 @@ import qualified Data.Text.IO as T import Data.CallStack import System.Exit+import System.IO import qualified Control.Concurrent.Async as A import qualified Data.Map as Map import qualified System.Random as Random@@ -95,7 +96,20 @@   pure $ \msg ->     -- force msg before acquiring lock     let dummy = T.foldl' (\_ ch -> ch == 'a') True msg-    in dummy `seq` bracket (takeMVar lock) (\_ -> putMVar lock ()) (\_ -> T.putStrLn msg)+    in dummy `seq` bracket (takeMVar lock) (\_ -> putMVar lock ()) (\_ -> T.putStrLn $ sanitize msg)++sanitize :: Text -> Text+sanitize msg = if isUnicodeLocale+    then msg+    else T.replace "✅" "!"+       . T.replace "❌" "X"+       . T.replace "😶" ":/"+       . T.replace "👍" ":D"+       . T.replace "🎉" ":P"+       $ msg++isUnicodeLocale :: Bool+isUnicodeLocale = elem (show localeEncoding) $ map show [utf8, utf8_bom, utf16, utf16le, utf16be, utf32, utf32le, utf32be]  -- | A test with a setup and teardown using :: IO r -> (r -> IO ()) -> (r -> Test a) -> Test a