packages feed

tasty 1.0.0.1 → 1.0.1

raw patch · 7 files changed

+60/−28 lines, 7 filesdep −deepseqPVP ok

version bump matches the API change (PVP)

Dependencies removed: deepseq

API changes (from Hackage documentation)

+ Test.Tasty.Options: safeReadBool :: String -> Maybe Bool
+ Test.Tasty.Runners: forceElements :: [a] -> ()

Files

CHANGELOG.md view
@@ -1,6 +1,12 @@ Changes ======= +Version 1.0.1+-------------++* Add a `safeReadBool` function, for case-insensitive parsing of boolean options+* Convert all tasty's own options to case-insensitive+ Version 1.0.0.1 --------------- 
README.md view
@@ -176,15 +176,16 @@ Mmm... tasty test suite  Usage: test [-p|--pattern ARG] [-t|--timeout ARG] [-l|--list-tests]-            [-j|--num-threads ARG] [-q|--quiet] [--hide-successes] [--color ARG]-            [--quickcheck-tests ARG] [--quickcheck-replay ARG]-            [--quickcheck-show-replay ARG] [--quickcheck-max-size ARG]-            [--quickcheck-max-ratio ARG] [--quickcheck-verbose]-            [--smallcheck-depth ARG]+            [-j|--num-threads ARG] [-q|--quiet] [--hide-successes]+            [--color never|always|auto] [--smallcheck-depth NUMBER]+            [--quickcheck-tests NUMBER] [--quickcheck-replay SEED]+            [--quickcheck-show-replay] [--quickcheck-max-size NUMBER]+            [--quickcheck-max-ratio NUMBER] [--quickcheck-verbose]  Available options:   -h,--help                Show this help text-  -p,--pattern ARG         Select only tests that match pattern+  -p,--pattern ARG         Select only tests which satisfy a pattern or awk+                           expression   -t,--timeout ARG         Timeout for individual tests (suffixes: ms,s,m,h;                            default: s)   -l,--list-tests          Do not run the tests; just print their names@@ -192,19 +193,21 @@   -q,--quiet               Do not produce any output; indicate success only by                            the exit code   --hide-successes         Do not print tests that passed successfully-  --color ARG              When to use colored output. Options are 'never',-                           'always' and 'auto' (default: 'auto')-  --quickcheck-tests ARG   Number of test cases for QuickCheck to generate-  --quickcheck-replay ARG  Replay token to use for replaying a previous test run-  --quickcheck-show-replay ARG-                           Show a replay token for replaying tests-  --quickcheck-max-size ARG+  --color never|always|auto+                           When to use colored output (default: 'auto')+  --smallcheck-depth NUMBER+                           Depth to use for smallcheck tests+  --quickcheck-tests NUMBER+                           Number of test cases for QuickCheck to generate+  --quickcheck-replay SEED Random seed to use for replaying a previous test run+                           (use same --quickcheck-max-size)+  --quickcheck-show-replay Show a replay token for replaying tests+  --quickcheck-max-size NUMBER                            Size of the biggest test cases quickcheck generates-  --quickcheck-max-ratio ARG+  --quickcheck-max-ratio NUMBER                            Maximum number of discared tests per successful test                            before giving up   --quickcheck-verbose     Show the generated test cases-  --smallcheck-depth ARG   Depth to use for smallcheck tests ```  Every option can be passed via environment. To obtain the environment variable@@ -213,6 +216,12 @@ `--smallcheck-depth` is `TASTY_SMALLCHECK_DEPTH`. To turn on a switch (such as `TASTY_HIDE_SUCCESSES`), set the variable to `True`. +Note on boolean options: by convention, boolean ("on/off") options are specified+using a switch on the command line, for example `--quickcheck-show-replay`+instead of `--quickcheck-show-replay=true`. However, when+passed via the environment, the option value needs to be `True` or `False`+(case-insensitive), e.g. `TASTY_QUICKCHECK_SHOW_REPLAY=true`.+ If you're using a non-console runner, please refer to its documentation to find out how to configure options during the run time. @@ -686,13 +695,16 @@ * [First time testing, also with FP Complete](http://levischuck.com/posts/2013-11-13-first-testing-and-fpcomplete.html)   (tasty has been added to stackage since then) * [24 Days of Hackage: tasty](http://ocharles.org.uk/blog/posts/2013-12-03-24-days-of-hackage-tasty.html)-* [Resources in Tasty](http://ro-che.info/articles/2013-12-10-tasty-resources.html)+* [Resources in Tasty](https://ro-che.info/articles/2013-12-10-tasty-resources) * [Custom options in Tasty][custom-options-article]-* [Resources in Tasty (update)](http://ro-che.info/articles/2013-12-29-tasty-resources-2.html)+* [Resources in Tasty (update)](https://ro-che.info/articles/2013-12-29-tasty-resources-2) * [Announcing tasty-rerun](http://ocharles.org.uk/blog/posts/2014-01-20-announcing-tasty-rerun.html) * [Code testing in Haskell revisited (with Tasty)](http://lambda.jstolarek.com/2014/01/code-testing-in-haskell-revisited-with-tasty/)+* [New patterns in tasty][awk-patterns-article]+* [Screencast: Dynamic Test Suites in Haskell using Hspec and Tasty](https://www.youtube.com/watch?v=PGsDvgmZF7A) -[custom-options-article]: http://ro-che.info/articles/2013-12-20-tasty-custom-options.html+[custom-options-article]: https://ro-che.info/articles/2013-12-20-tasty-custom-options.html+[awk-patterns-article]: https://ro-che.info/articles/2018-01-08-tasty-new-patterns  Maintainers -----------
Test/Tasty/Ingredients/ConsoleReporter.hs view
@@ -423,7 +423,7 @@   deriving (Eq, Ord, Typeable) instance IsOption Quiet where   defaultValue = Quiet False-  parseValue = fmap Quiet . safeRead+  parseValue = fmap Quiet . safeReadBool   optionName = return "quiet"   optionHelp = return "Do not produce any output; indicate success only by the exit code"   optionCLParser = mkFlagCLParser (short 'q') (Quiet True)@@ -433,7 +433,7 @@   deriving (Eq, Ord, Typeable) instance IsOption HideSuccesses where   defaultValue = HideSuccesses False-  parseValue = fmap HideSuccesses . safeRead+  parseValue = fmap HideSuccesses . safeReadBool   optionName = return "hide-successes"   optionHelp = return "Do not print tests that passed successfully"   optionCLParser = mkFlagCLParser mempty (HideSuccesses True)@@ -452,7 +452,8 @@   defaultValue = Auto   parseValue = parseUseColor   optionName = return "color"-  optionHelp = return "When to use colored output. Options are 'never', 'always' and 'auto' (default: 'auto')"+  optionHelp = return "When to use colored output (default: 'auto')"+  optionCLParser = mkOptionCLParser $ metavar "never|always|auto"  -- | @useColor when isTerm@ decides if colors should be used, --   where @isTerm@ indicates whether @stdout@ is a terminal device.
Test/Tasty/Ingredients/ListTests.hs view
@@ -20,7 +20,7 @@   deriving (Eq, Ord, Typeable) instance IsOption ListTests where   defaultValue = ListTests False-  parseValue = fmap ListTests . safeRead+  parseValue = fmap ListTests . safeReadBool   optionName = return "list-tests"   optionHelp = return "Do not run the tests; just print their names"   optionCLParser = mkFlagCLParser (short 'l') (ListTests True)
Test/Tasty/Options.hs view
@@ -20,10 +20,12 @@   , mkFlagCLParser   , mkOptionCLParser   , safeRead+  , safeReadBool   ) where  import qualified Data.Map as Map import Data.Map (Map)+import Data.Char (toLower) import Data.Tagged import Data.Proxy import Data.Typeable@@ -40,7 +42,8 @@ class Typeable v => IsOption v where   -- | The value to use if the option was not supplied explicitly   defaultValue :: v-  -- | Try to parse an option value from a string+  -- | Try to parse an option value from a string. Consider using+  -- 'safeReadBool' for boolean options and 'safeRead' for numeric options.   parseValue :: String -> Maybe v   -- | The option name. It is used to form the command line option name, for   -- instance. Therefore, it had better not contain spaces or other fancy@@ -155,3 +158,11 @@ safeRead s   | [(x, "")] <- reads s = Just x   | otherwise = Nothing++-- | Parse a 'Bool' case-insensitively+safeReadBool :: String -> Maybe Bool+safeReadBool s =+  case (map toLower s) of+    "true" -> Just True+    "false" -> Just False+    _ -> Nothing
Test/Tasty/Runners/Utils.hs view
@@ -2,7 +2,6 @@ module Test.Tasty.Runners.Utils where  import Control.Exception-import Control.DeepSeq import Control.Applicative import Prelude  -- Silence AMP import warnings import Text.Printf@@ -21,7 +20,11 @@     go :: Int -> String -> IO String     go 0        _ = return "exceptions keep throwing other exceptions!"     go recLimit msg = do-      mbStr <- try $ evaluate $ force msg+      mbStr <- try $ evaluate $ forceElements msg       case mbStr of-        Right str -> return str+        Right () -> return msg         Left e' -> printf "message threw an exception: %s" <$> go (recLimit-1) (show (e' :: SomeException))++-- https://ro-che.info/articles/2015-05-28-force-list+forceElements :: [a] -> ()+forceElements = foldr seq ()
tasty.cabal view
@@ -2,7 +2,7 @@ --  see http://haskell.org/cabal/users-guide/  name:                tasty-version:             1.0.0.1+version:             1.0.1 synopsis:            Modern and extensible testing framework description:         Tasty is a modern testing framework for Haskell.                      It lets you combine your unit tests, golden@@ -64,7 +64,6 @@     mtl >= 2.1.3.1,     tagged >= 0.5,     optparse-applicative >= 0.14,-    deepseq >= 1.3,     unbounded-delays >= 0.1,     async >= 2.0,     ansi-terminal >= 0.6.2