Hello community, here is the log from the commit of package ghc-hspec-core for openSUSE:Factory checked in at 2018-07-24 17:19:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-hspec-core (Old) and /work/SRC/openSUSE:Factory/.ghc-hspec-core.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hspec-core" Tue Jul 24 17:19:45 2018 rev:8 rq:623789 version:2.5.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-hspec-core/ghc-hspec-core.changes 2018-05-30 12:25:59.828956516 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-hspec-core.new/ghc-hspec-core.changes 2018-07-24 17:19:50.359104142 +0200 @@ -1,0 +2,18 @@ +Wed Jul 18 14:26:27 UTC 2018 - [email protected] + +- Cosmetic: replace tabs with blanks, strip trailing white space, + and update copyright headers with spec-cleaner. + +------------------------------------------------------------------- +Tue Jul 17 19:31:17 UTC 2018 - [email protected] + +- Update hspec-core to version 2.5.5. + Upstream does not provide a change log file. + +------------------------------------------------------------------- +Fri Jul 13 14:31:56 UTC 2018 - [email protected] + +- Update hspec-core to version 2.5.4. + Upstream does not provide a change log file. + +------------------------------------------------------------------- @@ -51 +68,0 @@ - Old: ---- hspec-core-2.5.0.tar.gz New: ---- hspec-core-2.5.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-hspec-core.spec ++++++ --- /var/tmp/diff_new_pack.HMJyn3/_old 2018-07-24 17:19:50.943104892 +0200 +++ /var/tmp/diff_new_pack.HMJyn3/_new 2018-07-24 17:19:50.947104897 +0200 @@ -19,7 +19,7 @@ %global pkg_name hspec-core %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.5.0 +Version: 2.5.5 Release: 0 Summary: A Testing Framework for Haskell License: MIT ++++++ hspec-core-2.5.0.tar.gz -> hspec-core-2.5.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/LICENSE new/hspec-core-2.5.5/LICENSE --- old/hspec-core-2.5.0/LICENSE 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/LICENSE 2018-07-16 22:34:21.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2011-2017 Simon Hengel <[email protected]> +Copyright (c) 2011-2018 Simon Hengel <[email protected]> Copyright (c) 2011-2012 Trystan Spangler <[email protected]> Copyright (c) 2011-2011 Greg Weber <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/hspec-core.cabal new/hspec-core-2.5.5/hspec-core.cabal --- old/hspec-core-2.5.0/hspec-core.cabal 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/hspec-core.cabal 2018-07-16 22:34:21.000000000 +0200 @@ -1,19 +1,20 @@ --- This file has been generated from package.yaml by hpack version 0.25.0. +cabal-version: >= 1.10 + +-- This file has been generated from package.yaml by hpack version 0.29.5. -- -- see: https://github.com/sol/hpack -- --- hash: b85e0f85042731ca2893e4ab243f2694f46c7b9d527d7d0d81bd05fc2bdfcd32 +-- hash: 18722f32fa5f70fec923fb16bae44075fdcc96cfab7622d6d9146d22fb7faed5 name: hspec-core -version: 2.5.0 +version: 2.5.5 license: MIT license-file: LICENSE -copyright: (c) 2011-2017 Simon Hengel, +copyright: (c) 2011-2018 Simon Hengel, (c) 2011-2012 Trystan Spangler, (c) 2011 Greg Weber maintainer: Simon Hengel <[email protected]> build-type: Simple -cabal-version: >= 1.10 category: Testing stability: experimental bug-reports: https://github.com/hspec/hspec/issues diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Compat.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Compat.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Compat.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Compat.hs 2018-07-16 22:34:21.000000000 +0200 @@ -9,6 +9,7 @@ , module Prelude , module Control.Applicative +, module Control.Monad , module Data.Foldable , module Data.Traversable , module Data.Monoid @@ -22,6 +23,15 @@ ) where import Control.Applicative +import Control.Monad hiding ( + mapM + , mapM_ + , forM + , forM_ + , msum + , sequence + , sequence_ + ) import Data.Foldable import Data.Traversable import Data.Monoid diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Config/Options.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Config/Options.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Config/Options.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Config/Options.hs 2018-07-16 22:34:21.000000000 +0200 @@ -10,7 +10,6 @@ ) where import Prelude () -import Control.Monad import Test.Hspec.Core.Compat import System.IO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Config.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Config.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Config.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Config.hs 2018-07-16 22:34:21.000000000 +0200 @@ -12,9 +12,9 @@ ) where import Prelude () +import Test.Hspec.Core.Compat import Control.Exception -import Control.Monad import Data.Maybe import System.IO import System.IO.Error @@ -24,7 +24,6 @@ import qualified Test.QuickCheck as QC import Test.Hspec.Core.Util -import Test.Hspec.Core.Compat import Test.Hspec.Core.Config.Options import Test.Hspec.Core.FailureReport import Test.Hspec.Core.QuickCheckUtil (mkGen) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Example.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Example.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Example.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Example.hs 2018-07-16 22:34:21.000000000 +0200 @@ -113,7 +113,7 @@ type Arg (a -> Result) = a evaluateExample example _params action _callback = do ref <- newIORef (Result "" Success) - action (writeIORef ref . example) + action (evaluate . example >=> writeIORef ref) readIORef ref instance Example Bool where @@ -124,12 +124,12 @@ type Arg (a -> Bool) = a evaluateExample p _params action _callback = do ref <- newIORef (Result "" Success) - action $ \a -> example a >>= writeIORef ref + action (evaluate . example >=> writeIORef ref) readIORef ref where example a - | p a = return (Result "" Success) - | otherwise = return (Result "" $ Failure Nothing NoReason) + | p a = Result "" Success + | otherwise = Result "" $ Failure Nothing NoReason instance Example Expectation where type Arg Expectation = () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/FailureReport.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/FailureReport.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/FailureReport.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/FailureReport.hs 2018-07-16 22:34:21.000000000 +0200 @@ -5,14 +5,15 @@ , readFailureReport ) where +import Prelude () +import Test.Hspec.Core.Compat + #ifndef __GHCJS__ import System.SetEnv import Test.Hspec.Core.Util (safeTry) #endif -import Control.Monad import System.IO import System.Directory -import Test.Hspec.Core.Compat import Test.Hspec.Core.Util (Path) import Test.Hspec.Core.Config.Options (Config(..)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters/Diff.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters/Diff.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters/Diff.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters/Diff.hs 2018-07-16 22:34:21.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE ViewPatterns #-} module Test.Hspec.Core.Formatters.Diff ( Diff (..) , diff @@ -8,17 +9,21 @@ #endif ) where +import Prelude () +import Test.Hspec.Core.Compat + import Data.Char +import Data.List (stripPrefix) import Data.Algorithm.Diff diff :: String -> String -> [Diff String] diff expected actual = map (fmap concat) $ getGroupedDiff (partition expected) (partition actual) partition :: String -> [String] -partition = mergeBackslashes . breakList isAlphaNum +partition = filter (not . null) . mergeBackslashes . breakList isAlphaNum where mergeBackslashes xs = case xs of - ['\\'] : (y : ys) : zs -> ['\\', y] : ys : mergeBackslashes zs + ['\\'] : (splitEscape -> Just (escape, ys)) : zs -> ("\\" ++ escape) : ys : mergeBackslashes zs z : zs -> z : mergeBackslashes zs [] -> [] @@ -31,3 +36,55 @@ cons x | null x = id | otherwise = (x :) + +splitEscape :: String -> Maybe (String, String) +splitEscape xs = splitNumericEscape xs <|> (msum $ map split escapes) + where + split :: String -> Maybe (String, String) + split escape = (,) escape <$> stripPrefix escape xs + +splitNumericEscape :: String -> Maybe (String, String) +splitNumericEscape xs = case span isDigit xs of + ("", _) -> Nothing + r -> Just r + +escapes :: [String] +escapes = [ + "ACK" + , "CAN" + , "DC1" + , "DC2" + , "DC3" + , "DC4" + , "DEL" + , "DLE" + , "ENQ" + , "EOT" + , "ESC" + , "ETB" + , "ETX" + , "NAK" + , "NUL" + , "SOH" + , "STX" + , "SUB" + , "SYN" + , "EM" + , "FS" + , "GS" + , "RS" + , "SI" + , "SO" + , "US" + , "a" + , "b" + , "f" + , "n" + , "r" + , "t" + , "v" + , "&" + , "'" + , "\"" + , "\\" + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters/Internal.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters/Internal.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters/Internal.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters/Internal.hs 2018-07-16 22:34:21.000000000 +0200 @@ -16,7 +16,6 @@ import qualified System.IO as IO import System.IO (Handle) -import Control.Monad import Control.Exception (AsyncException(..), bracket_, try, throwIO) import System.Console.ANSI import Control.Monad.Trans.State hiding (state, gets, modify) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Formatters.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Formatters.hs 2018-07-16 22:34:21.000000000 +0200 @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} -- | -- Stability: experimental -- @@ -61,7 +62,6 @@ import Test.Hspec.Core.Util import Test.Hspec.Core.Spec (Location(..)) import Text.Printf -import Control.Monad (unless) -- We use an explicit import list for "Test.Hspec.Formatters.Internal", to make -- sure, that we only use the public API to implement formatters. @@ -184,6 +184,16 @@ formatFailure x writeLine "" +#if __GLASGOW_HASKELL__ == 800 + withFailColor $ do + writeLine "WARNING:" + writeLine " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285." + writeLine " Source locations may not work as expected." + writeLine "" + writeLine " Please consider upgrading GHC!" + writeLine "" +#endif + write "Randomized with seed " >> usedSeed >>= writeLine . show writeLine "" where @@ -219,6 +229,9 @@ (xs, "") -> output xs (xs, _ : ys) -> output (xs ++ "\n") >> write (indentation ++ " ") >> indented output ys Error _ e -> withFailColor . indent $ (("uncaught exception: " ++) . formatException) e + + writeLine "" + writeLine (" To rerun use: --match " ++ show (joinPath path)) where indentation = " " indent message = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Runner/Eval.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Runner/Eval.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Runner/Eval.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Runner/Eval.hs 2018-07-16 22:34:21.000000000 +0200 @@ -23,7 +23,6 @@ import Test.Hspec.Core.Compat hiding (Monad) import qualified Test.Hspec.Core.Compat as M -import Control.Monad (unless, when) import qualified Control.Exception as E import Control.Concurrent import Control.Concurrent.Async hiding (cancel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Runner.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Runner.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Runner.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Runner.hs 2018-07-16 22:34:21.000000000 +0200 @@ -25,7 +25,6 @@ import Prelude () import Test.Hspec.Core.Compat -import Control.Monad import Data.Maybe import System.IO import System.Environment (getProgName, getArgs, withArgs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Spec/Monad.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Spec/Monad.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Spec/Monad.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Spec/Monad.hs 2018-07-16 22:34:21.000000000 +0200 @@ -7,7 +7,6 @@ , fromSpecList , runIO -, mapSpecTree , mapSpecItem , mapSpecItem_ , modifyParams @@ -16,6 +15,7 @@ import Prelude () import Test.Hspec.Core.Compat +import Control.Arrow import Control.Monad.Trans.Writer import Control.Monad.IO.Class (liftIO) @@ -49,8 +49,8 @@ runIO :: IO r -> SpecM a r runIO = SpecM . liftIO -mapSpecTree :: (SpecTree a -> SpecTree b) -> SpecWith a -> SpecWith b -mapSpecTree f spec = runIO (runSpecM spec) >>= fromSpecList . map f +mapSpecTree :: (SpecTree a -> SpecTree b) -> SpecM a r -> SpecM b r +mapSpecTree f (SpecM specs) = SpecM (mapWriterT (fmap (second (map f))) specs) mapSpecItem :: (ActionWith a -> ActionWith b) -> (Item a -> Item b) -> SpecWith a -> SpecWith b mapSpecItem g f = mapSpecTree go diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Spec.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Spec.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Spec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Spec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -45,22 +45,22 @@ import Test.Hspec.Core.Spec.Monad -- | The @describe@ function combines a list of specs into a larger spec. -describe :: String -> SpecWith a -> SpecWith a +describe :: HasCallStack => String -> SpecWith a -> SpecWith a describe label spec = runIO (runSpecM spec) >>= fromSpecList . return . specGroup label -- | @context@ is an alias for `describe`. -context :: String -> SpecWith a -> SpecWith a +context :: HasCallStack => String -> SpecWith a -> SpecWith a context = describe -- | -- Changing `describe` to `xdescribe` marks all spec items of the corresponding subtree as pending. -- -- This can be used to temporarily disable spec items. -xdescribe :: String -> SpecWith a -> SpecWith a +xdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a xdescribe label spec = before_ pending_ $ describe label spec -- | @xcontext@ is an alias for `xdescribe`. -xcontext :: String -> SpecWith a -> SpecWith a +xcontext :: HasCallStack => String -> SpecWith a -> SpecWith a xcontext = xdescribe -- | The @it@ function creates a spec item. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Timer.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Timer.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Timer.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Timer.hs 2018-07-16 22:34:21.000000000 +0200 @@ -1,11 +1,12 @@ module Test.Hspec.Core.Timer (withTimer) where +import Prelude () +import Test.Hspec.Core.Compat + import Control.Exception -import Control.Monad import Control.Concurrent.Async import Test.Hspec.Core.Clock -import Test.Hspec.Core.Compat withTimer :: Seconds -> (IO Bool -> IO a) -> IO a withTimer delay action = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Tree.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Tree.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Tree.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Tree.hs 2018-07-16 22:34:21.000000000 +0200 @@ -19,6 +19,7 @@ import Test.Hspec.Core.Compat import Data.CallStack +import Data.Maybe import Test.Hspec.Core.Example @@ -56,22 +57,29 @@ } -- | The @specGroup@ function combines a list of specs into a larger spec. -specGroup :: String -> [SpecTree a] -> SpecTree a +specGroup :: HasCallStack => String -> [SpecTree a] -> SpecTree a specGroup s = Node msg where + msg :: HasCallStack => String msg - | null s = "(no description given)" + | null s = fromMaybe "(no description given)" defaultDescription | otherwise = s -- | The @specItem@ function creates a spec item. specItem :: (HasCallStack, Example a) => String -> a -> SpecTree (Arg a) specItem s e = Leaf $ Item requirement location Nothing (safeEvaluateExample e) where + requirement :: HasCallStack => String requirement - | null s = "(unspecified behavior)" + | null s = fromMaybe "(unspecified behavior)" defaultDescription | otherwise = s location :: HasCallStack => Maybe Location location = case reverse callStack of (_, loc) : _ -> Just (Location (srcLocFile loc) (srcLocStartLine loc) (srcLocStartCol loc)) _ -> Nothing + +defaultDescription :: HasCallStack => Maybe String +defaultDescription = case reverse callStack of + (_, loc) : _ -> Just (srcLocModule loc ++ "[" ++ show (srcLocStartLine loc) ++ ":" ++ show (srcLocStartCol loc) ++ "]") + _ -> Nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/src/Test/Hspec/Core/Util.hs new/hspec-core-2.5.5/src/Test/Hspec/Core/Util.hs --- old/hspec-core-2.5.0/src/Test/Hspec/Core/Util.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/src/Test/Hspec/Core/Util.hs 2018-07-16 22:34:21.000000000 +0200 @@ -7,6 +7,7 @@ -- * Working with paths , Path +, joinPath , formatRequirement , filterPredicate @@ -68,6 +69,12 @@ type Path = ([String], String) -- | +-- Join a `Path` with slashes. The result will have a leading and a trailing +-- slash. +joinPath :: Path -> String +joinPath (groups, requirement) = "/" ++ intercalate "/" (groups ++ [requirement]) ++ "/" + +-- | -- Try to create a proper English sentence from a path by applying some -- heuristics. formatRequirement :: Path -> String @@ -83,11 +90,11 @@ -- | A predicate that can be used to filter a spec tree. filterPredicate :: String -> Path -> Bool -filterPredicate pattern path@(groups, requirement) = +filterPredicate pattern path = pattern `isInfixOf` plain || pattern `isInfixOf` formatted where - plain = intercalate "/" (groups ++ [requirement]) + plain = joinPath path formatted = formatRequirement path -- | The function `formatException` converts an exception to a string. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Helper.hs new/hspec-core-2.5.5/test/Helper.hs --- old/hspec-core-2.5.0/test/Helper.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Helper.hs 2018-07-16 22:34:21.000000000 +0200 @@ -30,7 +30,6 @@ import Data.List import Data.Char -import Control.Monad (guard) import System.Environment (withArgs, getEnvironment) import System.Exit import qualified Control.Exception as E @@ -41,7 +40,7 @@ import System.Directory import System.IO.Temp -import Test.Hspec.Meta +import Test.Hspec.Meta hiding (hspec, hspecResult) import Test.QuickCheck hiding (Result(..)) import qualified Test.Hspec.Core.Spec as H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/Config/OptionsSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/Config/OptionsSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/Config/OptionsSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/Config/OptionsSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -3,7 +3,6 @@ import Prelude () import Helper -import Control.Monad import System.Exit import qualified Test.Hspec.Core.Config.Options as Options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/ExampleSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/ExampleSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/ExampleSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/ExampleSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -61,6 +61,9 @@ describe "evaluateExample" $ do context "for Result" $ do + it "propagates exceptions" $ do + evaluateExample (error "foobar" :: Result) `shouldThrow` errorCall "foobar" + it "runs around-action" $ do ref <- newIORef (0 :: Int) let action :: IO () -> IO () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/Formatters/DiffSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/Formatters/DiffSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/Formatters/DiffSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/Formatters/DiffSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -1,15 +1,40 @@ +{-# LANGUAGE ScopedTypeVariables #-} module Test.Hspec.Core.Formatters.DiffSpec (spec) where +import Prelude () +import Test.Hspec.Core.Compat + import Helper import Data.Char import Test.Hspec.Core.Formatters.Diff +dropQuotes :: String -> String +dropQuotes = init . tail + spec :: Spec spec = do describe "partition" $ do - it "puts backslash-escaped characters into a separate chunks" $ do - partition (show "foo\nbar") `shouldBe` ["\"", "foo", "\\n", "bar", "\""] + context "with a single shown Char" $ do + it "never partitions a character escape" $ do + property $ \ (c :: Char) -> partition (show c) `shouldBe` ["'", dropQuotes (show c), "'"] + + context "with a shown String" $ do + it "puts backslash-escaped characters into separate chunks" $ do + partition (show "foo\nbar") `shouldBe` ["\"", "foo", "\\n", "bar", "\""] + + it "puts *arbitrary* backslash-escaped characters into separate chunks" $ do + property $ \ xs c ys -> + let + char = dropQuotes (show [c]) + isEscaped = length char > 1 + escape = tail char + sep = case ys of + x : _ | all isDigit escape && isDigit x || escape == "SO" && x == 'H' -> ["\\&"] + _ -> [] + actual = partition (show (xs ++ c : ys)) + expected = partition (init $ show xs) ++ [char] ++ sep ++ partition (tail $ show ys) + in isEscaped ==> actual `shouldBe` expected describe "breakList" $ do context "with a list where the predicate matches at the beginning and the end" $ do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/FormattersSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/FormattersSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/FormattersSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/FormattersSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Test.Hspec.Core.FormattersSpec (spec) where @@ -216,6 +217,16 @@ , " two" , " third" , "" + , " To rerun use: --match \"//\"" + , "" +#if __GLASGOW_HASKELL__ == 800 + , "WARNING:" + , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285." + , " Source locations may not work as expected." + , "" + , " Please consider upgrading GHC!" + , "" +#endif , "Randomized with seed 0" , "" ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/RunnerSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/RunnerSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/RunnerSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/RunnerSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -13,7 +13,6 @@ import Helper import System.IO (stderr) -import Control.Monad (replicateM_) import System.Environment (withArgs, withProgName, getArgs) import System.Exit import Control.Concurrent @@ -44,9 +43,14 @@ spec :: Spec spec = do describe "hspec" $ do + + let + hspec args = withArgs ("--format=silent" : args) . H.hspec + hspec_ = hspec [] + it "evaluates examples Unmasked" $ do mvar <- newEmptyMVar - withArgs ["--format", "silent"] . H.hspec $ do + hspec_ $ do H.it "foo" $ do E.getMaskingState >>= putMVar mvar takeMVar mvar `shouldReturn` E.Unmasked @@ -54,7 +58,7 @@ it "runs finalizers" $ do mvar <- newEmptyMVar ref <- newIORef "did not run finalizer" - a <- async $ withArgs ["--format", "silent"] . H.hspec $ do + a <- async $ hspec_ $ do H.it "foo" $ do (putMVar mvar () >> threadDelay 10000000) `E.finally` writeIORef ref "ran finalizer" @@ -63,12 +67,12 @@ readIORef ref `shouldReturn` "ran finalizer" it "runs a spec" $ do - silence . H.hspec $ do + hspec_ $ do H.it "foobar" True `shouldReturn` () it "exits with exitFailure if not all examples pass" $ do - silence . H.hspec $ do + hspec_ $ do H.it "foobar" False `shouldThrow` (== ExitFailure 1) @@ -87,7 +91,7 @@ ] it "stores a failure report in the environment" $ do - silence . ignoreExitCode . withArgs ["--seed", "23"] . H.hspec $ do + ignoreExitCode . hspec ["--seed", "23"] $ do H.describe "foo" $ do H.describe "bar" $ do H.it "example 1" True @@ -166,11 +170,10 @@ it "does not leak command-line options to examples" $ do - silence . withArgs ["--verbose"] $ do - H.hspec $ do - H.it "foobar" $ do - getArgs `shouldReturn` [] - `shouldReturn` () + hspec ["--diff"] $ do + H.it "foobar" $ do + getArgs `shouldReturn` [] + `shouldReturn` () context "when interrupted with ctrl-c" $ do it "prints summary immediately" $ do @@ -195,6 +198,16 @@ , "" , " 1) foo" , "" + , " To rerun use: --match \"/foo/\"" + , "" +#if __GLASGOW_HASKELL__ == 800 + , "WARNING:" + , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285." + , " Source locations may not work as expected." + , "" + , " Please consider upgrading GHC!" + , "" +#endif , "Randomized with seed 23" , "" ] @@ -203,7 +216,7 @@ mvar <- newEmptyMVar sync <- newEmptyMVar threadId <- forkIO $ do - silence . H.hspec $ do + hspec_ $ do H.it "foo" $ do putMVar sync () threadDelay 1000000 @@ -256,6 +269,16 @@ , "" , " 1) bar" , "" + , " To rerun use: --match \"/bar/\"" + , "" +#if __GLASGOW_HASKELL__ == 800 + , "WARNING:" + , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285." + , " Source locations may not work as expected." + , "" + , " Please consider upgrading GHC!" + , "" +#endif , "Randomized with seed 23" , "" , "Finished in 0.0000 seconds" @@ -267,7 +290,7 @@ child2 <- newQSem 0 parent <- newQSem 0 ref <- newIORef "" - ignoreExitCode . withArgs ["--fail-fast", "--format=silent", "-j", "2"] . H.hspec $ do + ignoreExitCode . hspec ["--fail-fast", "-j", "2"] $ do H.parallel $ do H.it "foo" $ do waitQSem child1 @@ -294,6 +317,16 @@ , "" , " 1) foo bar" , "" + , " To rerun use: --match \"/foo/bar/\"" + , "" +#if __GLASGOW_HASKELL__ == 800 + , "WARNING:" + , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285." + , " Source locations may not work as expected." + , "" + , " Please consider upgrading GHC!" + , "" +#endif , "Randomized with seed 23" , "" , "Finished in 0.0000 seconds" @@ -305,7 +338,7 @@ e1 <- newMock e2 <- newMock e3 <- newMock - silence . withArgs ["-m", "/bar/example"] . H.hspec $ do + hspec ["-m", "/bar/example"] $ do H.describe "foo" $ do H.describe "bar" $ do H.it "example 1" $ mockAction e1 @@ -319,7 +352,7 @@ e2 <- newMock e3 <- newMock e4 <- newMock - silence . withArgs ["-m", "/bar/example", "--skip", "example 3"] . H.hspec $ do + hspec ["-m", "/bar/example", "--skip", "example 3"] $ do H.describe "foo" $ do H.describe "bar" $ do H.it "example 1" $ mockAction e1 @@ -334,7 +367,7 @@ e1 <- newMock e2 <- newMock e3 <- newMock - silence . withArgs ["-m", "foo", "-m", "baz"] . H.hspec $ do + hspec ["-m", "foo", "-m", "baz"] $ do H.describe "foo" $ do H.it "example 1" $ mockAction e1 H.describe "bar" $ do @@ -381,7 +414,7 @@ context "with --qc-max-success" $ do it "tries QuickCheck properties specified number of times" $ do m <- newMock - silence . withArgs ["--qc-max-success", "23"] . H.hspec $ do + hspec ["--qc-max-success", "23"] $ do H.it "foo" $ property $ \(_ :: Int) -> do mockAction m mockCounter m `shouldReturn` 23 @@ -447,8 +480,12 @@ r `shouldContain` "<span class=\"hspec-failure\">foo" describe "hspecResult" $ do + let + hspecResult args = withArgs ("--format=silent" : args) . H.hspecResult + hspecResult_ = hspecResult [] + it "returns a summary of the test run" $ do - silence . H.hspecResult $ do + hspecResult_ $ do H.it "foo" True H.it "foo" False H.it "foo" False @@ -457,7 +494,7 @@ `shouldReturn` H.Summary 5 2 it "treats uncaught exceptions as failure" $ do - silence . H.hspecResult $ do + hspecResult_ $ do H.it "foobar" throwException `shouldReturn` H.Summary 1 1 @@ -474,7 +511,7 @@ r `shouldBe` "" it "does not let escape error thunks from failure messages" $ do - r <- silence . H.hspecResult $ do + r <- hspecResult_ $ do H.it "some example" (H.Result "" $ H.Failure Nothing . H.Reason $ "foobar" ++ undefined) r `shouldBe` H.Summary 1 1 @@ -482,7 +519,7 @@ let n = 100 t = 0.01 dt = t * (fromIntegral n / 2) - r <- timeout dt . silence . withArgs ["-j", show n] . H.hspecResult . H.parallel $ do + r <- timeout dt . hspecResult ["-j", show n] . H.parallel $ do replicateM_ n (H.it "foo" $ sleep t) r `shouldBe` Just (H.Summary n 0) @@ -497,7 +534,7 @@ current <- atomicModifyIORef currentRef $ \x -> let y = succ x in (y, y) atomicModifyIORef highRef $ \x -> (max x current, ()) stop = atomicModifyIORef currentRef $ \x -> (pred x, ()) - r <- withArgs ["-j", show j] . H.hspecResult . H.parallel $ do + r <- hspecResult ["-j", show j] . H.parallel $ do replicateM_ n $ H.it "foo" $ E.bracket_ start stop $ sleep t r `shouldBe` H.Summary n 0 high <- readIORef highRef diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/SpecSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/SpecSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/SpecSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/SpecSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -26,7 +26,11 @@ context "when no description is given" $ do it "uses a default description" $ do [Node d _] <- runSpecM (H.describe "" (pure ())) +#if MIN_VERSION_base(4,8,1) + d `shouldBe` "Test.Hspec.Core.SpecSpec[" ++ show (__LINE__ - 2 :: Int) ++ ":33]" +#else d `shouldBe` "(no description given)" +#endif describe "xdescribe" $ do it "creates a tree of pending spec items" $ do @@ -57,7 +61,11 @@ context "when no description is given" $ do it "uses a default description" $ do [Leaf item] <- runSpecM (H.it "" True) +#if MIN_VERSION_base(4,8,1) + itemRequirement item `shouldBe` "Test.Hspec.Core.SpecSpec[" ++ show (__LINE__ - 2 :: Int) ++ ":34]" +#else itemRequirement item `shouldBe` "(unspecified behavior)" +#endif describe "xit" $ do it "creates a pending spec item" $ do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/TimerSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/TimerSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/TimerSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/TimerSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -2,12 +2,14 @@ import Helper -import Test.Hspec.Core.Timer +-- import Test.Hspec.Core.Timer spec :: Spec spec = do describe "timer action provided by withTimer" $ do + return () -- this test is fragile, see e.g. https://github.com/hspec/hspec/issues/352 +{- let dt = 0.01 wait = sleep (dt * 1.1) @@ -26,3 +28,4 @@ wait timer `shouldReturn` True timer `shouldReturn` False + -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.5.0/test/Test/Hspec/Core/UtilSpec.hs new/hspec-core-2.5.5/test/Test/Hspec/Core/UtilSpec.hs --- old/hspec-core-2.5.0/test/Test/Hspec/Core/UtilSpec.hs 2018-03-14 10:17:41.000000000 +0100 +++ new/hspec-core-2.5.5/test/Test/Hspec/Core/UtilSpec.hs 2018-07-16 22:34:21.000000000 +0200 @@ -84,6 +84,11 @@ let p = filterPredicate "ModuleA.ModuleB.foo does something" p (["ModuleA", "ModuleB", "foo"], "does something") `shouldBe` True + context "with an absolute path that begins or ends with a slash" $ do + it "succeeds" $ do + let p = filterPredicate "/foo/bar/baz/example 1/" + p (["foo", "bar", "baz"], "example 1") `shouldBe` True + describe "formatRequirement" $ do it "creates a sentence from a subject and a requirement" $ do formatRequirement (["reverse"], "reverses a list") `shouldBe` "reverse reverses a list"
