tasty 1.4.2.3 → 1.4.3
raw patch · 15 files changed
+80/−69 lines, 15 filesdep −clockdep −wcwidthnew-uploader
Dependencies removed: clock, wcwidth
Files
- CHANGELOG.md +14/−4
- README.md +7/−7
- Test/Tasty.hs +1/−1
- Test/Tasty/CmdLine.hs +5/−5
- Test/Tasty/Core.hs +5/−5
- Test/Tasty/Ingredients.hs +1/−1
- Test/Tasty/Ingredients/Basic.hs +2/−2
- Test/Tasty/Ingredients/ConsoleReporter.hs +10/−8
- Test/Tasty/Ingredients/IncludingOptions.hs +1/−1
- Test/Tasty/Options/Core.hs +2/−1
- Test/Tasty/Patterns/Eval.hs +1/−1
- Test/Tasty/Patterns/Parser.hs +3/−3
- Test/Tasty/Run.hs +10/−2
- Test/Tasty/Runners/Utils.hs +8/−16
- tasty.cabal +10/−12
CHANGELOG.md view
@@ -1,21 +1,31 @@ Changes ======= +Version 1.4.3+---------------++_2022-12-18_++* Drop `unbounded-delays` dependency on 64-bit machines (#344).+* Drop `clock` dependency, decomission `clock` flag (#345).+* Drop `wcwidth` dependency (#346)+* Tested with GHC 8.0 - 9.4.+ Version 1.4.2.3 --------------- _2022-05-10_ -- Drop `mtl` dependency-- Warning-free under GHC 8.0 - 9.2+* Drop `mtl` dependency+* Warning-free under GHC 8.0 - 9.2 Version 1.4.2.2 --------------- _2022-05-10_ -- Fix compilation with `mtl-2.3`-- Tested with GHC 8.0 - 9.2; dropped support for GHC 7.x+* Fix compilation with `mtl-2.3`+* Tested with GHC 8.0 - 9.2; dropped support for GHC 7.x Version 1.4.2.1 ---------------
README.md view
@@ -112,8 +112,8 @@ (based on [LeanCheck](https://hackage.haskell.org/package/leancheck)) * [tasty-program](https://hackage.haskell.org/package/tasty-program) — run external program and test whether it terminates successfully-* [tasty-wai](https://hackage.haskell.org/package/tasty-wai) — - for testing [wai](https://hackage.haskell.org/wai) endpoints.+* [tasty-wai](https://hackage.haskell.org/package/tasty-wai) —+ for testing [wai](https://hackage.haskell.org/package/wai) endpoints. * [tasty-inspection-testing](https://hackage.haskell.org/package/tasty-inspection-testing) — for compile-time testing of code properties (based on [inspection-testing](http://hackage.haskell.org/package/inspection-testing)).@@ -798,11 +798,11 @@ See [issue #152](https://github.com/UnkindPartition/tasty/issues/152). 3. **Q**: Patterns with slashes do not work on Windows. How can I fix it?- - **A**: If you are running Git for Windows terminal, it has a habit of converting slashes - to backslashes. Set `MSYS_NO_PATHCONV=1` to prevent this behaviour, or follow other ++ **A**: If you are running Git for Windows terminal, it has a habit of converting slashes+ to backslashes. Set `MSYS_NO_PATHCONV=1` to prevent this behaviour, or follow other suggestions from [Known Issues](https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues).- + ## Press Blog posts and other publications related to tasty. If you wrote or just found@@ -816,7 +816,7 @@ * [Custom options in Tasty][custom-options-article] * [Resources in Tasty (update)](https://ro-che.info/articles/2013-12-29-tasty-resources-2) * [Announcing tasty-rerun](https://ocharles.org.uk/blog/posts/2014-01-20-announcing-tasty-rerun.html)-* [Code testing in Haskell revisited (with Tasty)](http://ics.p.lodz.pl/~stolarek/blog/2014/01/code-testing-in-haskell-revisited-with-tasty/)+* [Code testing in Haskell revisited (with Tasty)](https://jstolarek.github.io/posts/2014-01-26-code-testing-in-haskell-revisited-with-tasty.html) * [New patterns in tasty][awk-patterns-article] * [Screencast: Dynamic Test Suites in Haskell using Hspec and Tasty](https://www.youtube.com/watch?v=PGsDvgmZF7A) * [Automatically generated directories for tasty tests][tasty-directories]
Test/Tasty.hs view
@@ -76,7 +76,7 @@ -- | Parse the command line arguments and run the tests. ----- When the tests finish, this function calls 'exitWith' with the exit code+-- When the tests finish, this function calls 'System.Exit.exitWith' with the exit code -- that indicates whether any tests have failed. Most external systems -- (stack, cabal, travis-ci, jenkins etc.) rely on the exit code to detect -- whether the tests pass. If you want to do something else after
Test/Tasty/CmdLine.hs view
@@ -141,13 +141,13 @@ -- | Parse the command-line and environment options passed to tasty. ----- Useful if you need to get the options before 'defaultMain' is called.+-- Useful if you need to get the options before 'Test.Tasty.defaultMain' is called. ----- Once within the test tree, 'askOption' should be used instead.+-- Once within the test tree, 'Test.Tasty.askOption' should be used instead. -- -- The arguments to this function should be the same as for -- 'defaultMainWithIngredients'. If you don't use any custom ingredients,--- pass 'defaultIngredients'.+-- pass 'Test.Tasty.defaultIngredients'. parseOptions :: [Ingredient] -> TestTree -> IO OptionSet parseOptions ins tree = do let (warnings, parser) = suiteOptionParser ins tree@@ -163,8 +163,8 @@ -- | Parse the command line arguments and run the tests using the provided -- ingredient list. ----- When the tests finish, this function calls 'exitWith' with the exit code--- that indicates whether any tests have failed. See 'defaultMain' for+-- When the tests finish, this function calls 'System.Exit.exitWith' with the exit code+-- that indicates whether any tests have failed. See 'Test.Tasty.defaultMain' for -- details. defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO () defaultMainWithIngredients ins testTree = do
Test/Tasty/Core.hs view
@@ -238,7 +238,7 @@ -- -- @ -- 'after_' 'AllFinish' ('Test.Tasty.Patterns.Types.EQ' ('Field' 'NF') ('StringLit' \"Bar\")) $--- 'testCase' \"A test that depends on Foo.Bar\" $ ...+-- @testCase@ \"A test that depends on Foo.Bar\" $ ... -- @ -- -- @since 1.2@@ -269,12 +269,12 @@ -- -- @ -- 'after' 'AllFinish' \"Foo\" $--- 'testCase' \"A test that depends on Foo.Bar\" $ ...+-- @testCase@ \"A test that depends on Foo.Bar\" $ ... -- @ -- -- Note, however, that our test also happens to contain @Foo@ as part of its name, -- so it also matches the pattern and becomes a dependency of itself. This--- will result in a 'DependencyLoop' exception. To avoid this, either+-- will result in a 'Test.Tasty.DependencyLoop' exception. To avoid this, either -- change the test name so that it doesn't mention @Foo@ or make the -- pattern more specific. --@@ -282,14 +282,14 @@ -- -- @ -- 'after' 'AllFinish' \"$0 == \\\"Tests.Foo.Bar\\\"\" $--- 'testCase' \"A test that depends on Foo.Bar\" $ ...+-- @testCase@ \"A test that depends on Foo.Bar\" $ ... -- @ -- -- Or only specify the dependency's own name, ignoring the group names: -- -- @ -- 'after' 'AllFinish' \"$NF == \\\"Bar\\\"\" $--- 'testCase' \"A test that depends on Foo.Bar\" $ ...+-- @testCase@ \"A test that depends on Foo.Bar\" $ ... -- @ -- -- @since 1.2
Test/Tasty/Ingredients.hs view
@@ -110,7 +110,7 @@ Option (Proxy :: Proxy NumThreads) : opts ingredientOptions (TestManager opts _) = opts --- | Like 'ingredientOption', but folds over multiple ingredients.+-- | Like 'ingredientOptions', but folds over multiple ingredients. ingredientsOptions :: [Ingredient] -> [OptionDescription] ingredientsOptions = uniqueOptionDescriptions . F.foldMap ingredientOptions
Test/Tasty/Ingredients/Basic.hs view
@@ -1,7 +1,7 @@--- | This module exports the basic ingredients defined in the 'tasty'+-- | This module exports the basic ingredients defined in the @tasty@ -- packages. ----- Note that if @defaultIngredients@ from "Test.Tasty" suits your needs,+-- Note that if 'Test.Tasty.defaultIngredients' from "Test.Tasty" suits your needs, -- use that instead of importing this module. module Test.Tasty.Ingredients.Basic (
Test/Tasty/Ingredients/ConsoleReporter.hs view
@@ -1,5 +1,5 @@ -- vim:fdm=marker-{-# LANGUAGE BangPatterns, ImplicitParams, MultiParamTypeClasses, DeriveDataTypeable, FlexibleContexts #-}+{-# LANGUAGE BangPatterns, ImplicitParams, MultiParamTypeClasses, DeriveDataTypeable, FlexibleContexts, CApiFFI #-} -- | Console reporter ingredient module Test.Tasty.Ingredients.ConsoleReporter ( consoleTestReporter@@ -48,8 +48,8 @@ import Text.Printf import qualified Data.IntMap as IntMap import Data.Char-#ifdef VERSION_wcwidth-import Data.Char.WCWidth (wcwidth)+#ifdef USE_WCWIDTH+import Foreign.C.Types (CInt(..), CWchar(..)) #endif import Data.List (isInfixOf) import Data.Maybe@@ -83,7 +83,7 @@ -- ^ Name of a test group, an action that prints the heading of a test -- group and the 'TestOutput' for that test group. | Skip -- ^ Inactive test (e.g. not matching the current pattern)- | Seq TestOutput TestOutput -- ^ Two sets of 'TestOuput' on the same level+ | Seq TestOutput TestOutput -- ^ Two sets of 'TestOutput' on the same level -- The monoid laws should hold observationally w.r.t. the semantics defined -- in this module@@ -503,7 +503,8 @@ -- | Report only failed tests. ----- At the moment, this option only works globally. As an argument to 'localOption', it does nothing.+-- At the moment, this option only works globally. As an argument+-- to 'Test.Tasty.localOption', it does nothing. newtype HideSuccesses = HideSuccesses Bool deriving (Eq, Ord, Typeable) instance IsOption HideSuccesses where@@ -678,11 +679,12 @@ -- (This only works properly on Unix at the moment; on Windows, the function -- treats every character as width-1 like 'Data.List.length' does.) stringWidth :: String -> Int-#ifdef VERSION_wcwidth+#ifdef USE_WCWIDTH stringWidth = Prelude.sum . map charWidth- where charWidth c = case wcwidth c of+ where charWidth c = case wcwidth (fromIntegral (ord c)) of -1 -> 1 -- many chars have "undefined" width; default to 1 for these.- w -> w+ w -> fromIntegral w+foreign import capi safe "wchar.h wcwidth" wcwidth :: CWchar -> CInt #else stringWidth = length #endif
Test/Tasty/Ingredients/IncludingOptions.hs view
@@ -7,6 +7,6 @@ -- | This ingredient doesn't do anything apart from registering additional -- options. ----- The option values can be accessed using 'askOption'.+-- The option values can be accessed using 'Test.Tasty.askOption'. includingOptions :: [OptionDescription] -> Ingredient includingOptions opts = TestManager opts (\_ _ -> Nothing)
Test/Tasty/Options/Core.hs view
@@ -26,7 +26,8 @@ -- -- Note that this is /not/ included in 'coreOptions'. -- Instead, it's automatically included in the options for any--- 'TestReporter' ingredient by 'ingredientOptions', because the way test+-- 'Test.Tasty.Ingredients.TestReporter' ingredient by+-- 'Test.Tasty.Ingredients.ingredientOptions', because the way test -- reporters are handled already involves parallelism. Other ingredients -- may also choose to include this option. newtype NumThreads = NumThreads { getNumThreads :: Int }
Test/Tasty/Patterns/Eval.hs view
@@ -153,7 +153,7 @@ -> Bool match pat str = pat `isInfixOf` str --- | Run the 'M' monad with a given list of fields+-- | Run the @M@ monad with a given list of fields -- -- The field list should not include @$0@; it's calculated automatically. withFields :: Seq.Seq String -> M a -> Either String a
Test/Tasty/Patterns/Parser.hs view
@@ -110,21 +110,21 @@ -- -- This roughly corresponds to the @unary_expr@ and @non_unary_expr@ -- non-terminals in the awk grammar.--- (Why roughly? See 'expr2'.)+-- (Why roughly? See @expr2@.) data Unary = Unary | NonUnary -- | Arithmetic expressions. -- -- Unlike awk, non-unary expressions disallow unary operators everywhere, -- not just in the leading position, to avoid extra complexity in--- 'makeExprParser'.+-- @makeExprParser@. -- -- For example, the expression -- -- >1 3 + -4 -- -- is valid in awk because @3 + -4@ is non-unary, but we disallow it here--- because 'makeExprParser' does not allow us to distinguish it from+-- because @makeExprParser@ does not allow us to distinguish it from -- -- >1 -4 + 3 --
Test/Tasty/Run.hs view
@@ -11,6 +11,7 @@ import qualified Data.IntMap as IntMap import qualified Data.Sequence as Seq import qualified Data.Foldable as F+import Data.Int (Int64) import Data.Maybe import Data.Graph (SCC(..), stronglyConnComp) import Data.Typeable@@ -21,7 +22,6 @@ import Control.Monad.Trans.Writer (WriterT(..), execWriterT, mapWriterT, tell) import Control.Concurrent import Control.Concurrent.STM-import Control.Concurrent.Timeout (timeout) import Control.Concurrent.Async import Control.Exception as E import Control.Applicative@@ -30,6 +30,12 @@ import GHC.Conc (labelThread) import Prelude -- Silence AMP and FTP import warnings +#ifdef MIN_VERSION_unbounded_delays+import Control.Concurrent.Timeout (timeout)+#else+import System.Timeout (timeout)+#endif+ import Test.Tasty.Core import Test.Tasty.Parallel import Test.Tasty.Patterns@@ -171,7 +177,9 @@ , resultTime = fromIntegral t , resultDetailsPrinter = noResultDetails }- fromMaybe timeoutResult <$> timeout t a+ -- If compiled with unbounded-delays then t' :: Integer, otherwise t' :: Int+ let t' = fromInteger (min (max 0 t) (toInteger (maxBound :: Int64)))+ fromMaybe timeoutResult <$> timeout t' a -- destroyResources should not be interrupted by an exception -- Here's how we ensure this:
Test/Tasty/Runners/Utils.hs view
@@ -7,15 +7,15 @@ import Control.Applicative import Control.Concurrent (mkWeakThreadId, myThreadId) import Control.Monad (forM_)-#ifndef VERSION_clock-import Data.Time.Clock.POSIX (getPOSIXTime)-#endif import Data.Typeable (Typeable) import Prelude -- Silence AMP import warnings import Text.Printf import Foreign.C (CInt)-#ifdef VERSION_clock-import qualified System.Clock as Clock++#if MIN_VERSION_base(4,11,0)+import GHC.Clock (getMonotonicTime)+#else+import Data.Time.Clock.POSIX (getPOSIXTime) #endif -- Install handlers only on UNIX@@ -63,7 +63,7 @@ -- -- This function is called automatically from the @defaultMain*@ family of -- functions. You only need to call it explicitly if you call--- 'tryIngredients' yourself.+-- 'Test.Tasty.Runners.tryIngredients' yourself. -- -- This function does nothing on non-UNIX systems or when compiled with GHC -- older than 7.6.@@ -102,21 +102,13 @@ end <- getTime return (end-start, r) -#ifdef VERSION_clock+#if MIN_VERSION_base(4,11,0) -- | Get monotonic time -- -- Warning: This is not the system time, but a monotonically increasing time -- that facilitates reliable measurement of time differences. getTime :: IO Time-getTime = do- t <- Clock.getTime Clock.Monotonic- let ns = realToFrac $-#if MIN_VERSION_clock(0,7,1)- Clock.toNanoSecs t-#else- Clock.timeSpecAsNanoSecs t-#endif- return $ ns / 10 ^ (9 :: Int)+getTime = getMonotonicTime #else -- | Get system time getTime :: IO Time
tasty.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: tasty-version: 1.4.2.3+version: 1.4.3 synopsis: Modern and extensible testing framework description: Tasty is a modern testing framework for Haskell. It lets you combine your unit tests, golden@@ -22,11 +22,6 @@ location: git://github.com/UnkindPartition/tasty.git subdir: core -flag clock- description:- Depend on the clock package for more accurate time measurement- default: True- flag unix description: Depend on the unix package to install signal handlers@@ -70,18 +65,21 @@ transformers >= 0.5, tagged >= 0.5, optparse-applicative >= 0.14,- unbounded-delays >= 0.1, ansi-terminal >= 0.9++ -- No reason to depend on unbounded-delays on 64-bit architecture+ if(!arch(x86_64) && !arch(aarch64))+ build-depends:+ unbounded-delays >= 0.1+ if(!impl(ghc >= 8.0)) build-depends: semigroups - if flag(clock) && !impl(ghcjs)- build-depends: clock >= 0.4.4.0- else- build-depends: time >= 1.4+ if(!impl(ghc >= 8.4))+ build-depends: time >= 1.4 if !os(windows) && !impl(ghcjs)- build-depends: wcwidth+ cpp-options: -DUSE_WCWIDTH if flag(unix) build-depends: unix