packages feed

hspec-core 2.9.4 → 2.9.5

raw patch · 22 files changed

+174/−108 lines, 22 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Test.Hspec.Core.Format: [formatConfigReportProgress] :: FormatConfig -> Bool
- Test.Hspec.Core.Format: FormatConfig :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Integer -> Int -> FormatConfig
+ Test.Hspec.Core.Format: FormatConfig :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Integer -> Int -> FormatConfig

Files

hspec-core.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.6.+-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack  name:             hspec-core-version:          2.9.4+version:          2.9.5 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2021 Simon Hengel,
src/Test/Hspec/Core/Example/Location.hs view
@@ -3,11 +3,14 @@   Location(..) , extractLocation --- for testing+#ifdef TEST , parseAssertionFailed , parseCallStack , parseLocation , parseSourceSpan++, workaroundForIssue19236+#endif ) where  import           Prelude ()@@ -18,6 +21,10 @@ import           Data.Maybe import           GHC.IO.Exception +#ifdef mingw32_HOST_OS+import           System.FilePath+#endif+ -- | @Location@ is used to represent source locations. data Location = Location {   locationFile :: FilePath@@ -96,11 +103,11 @@  parseLocation :: String -> Maybe Location parseLocation input = case fmap breakColon (breakColon input) of-  (file, (line, column)) -> Location file <$> readMaybe line <*> readMaybe column+  (file, (line, column)) -> mkLocation file <$> readMaybe line <*> readMaybe column  parseSourceSpan :: String -> Maybe Location parseSourceSpan input = case breakColon input of-  (file, xs) -> (uncurry $ Location file) <$> (tuple <|> colonSeparated)+  (file, xs) -> (uncurry $ mkLocation file) <$> (tuple <|> colonSeparated)     where       lineAndColumn :: String       lineAndColumn = takeWhile (/= '-') xs@@ -114,3 +121,14 @@  breakColon :: String -> (String, String) breakColon = fmap (drop 1) . break (== ':')++mkLocation :: FilePath -> Int -> Int -> Location+mkLocation file line column = Location (workaroundForIssue19236 file) line column++workaroundForIssue19236 :: FilePath -> FilePath -- https://gitlab.haskell.org/ghc/ghc/-/issues/19236+workaroundForIssue19236 =+#ifdef mingw32_HOST_OS+  joinPath . splitDirectories+#else+  id+#endif
src/Test/Hspec/Core/Format.hs view
@@ -56,6 +56,7 @@  data FormatConfig = FormatConfig {   formatConfigUseColor :: Bool+, formatConfigReportProgress :: Bool , formatConfigOutputUnicode :: Bool , formatConfigUseDiff :: Bool , formatConfigPrettyPrint :: Bool
src/Test/Hspec/Core/Formatters/Internal.hs view
@@ -208,8 +208,8 @@  writeTransient :: String -> FormatM () writeTransient new = do-  useColor <- getConfig formatConfigUseColor-  when (useColor) $ do+  reportProgress <- getConfig formatConfigReportProgress+  when (reportProgress) $ do     old <- gets stateTransientOutput     write $ old `overwriteWith` new     modify $ \ state -> state {stateTransientOutput = new}
src/Test/Hspec/Core/Formatters/Pretty.hs view
@@ -99,7 +99,7 @@       Char c -> shows c       String str -> if unicode then Builder $ ushows str else shows str       Integer n -> shows n-      Rational n -> shows n+      Rational n -> fromString n      render :: Expression -> Builder     render expr = case expr of
src/Test/Hspec/Core/Formatters/Pretty/Parser.hs view
@@ -146,7 +146,7 @@     HsOverLit _x lit -> toExpression lit     HsApp _x f x -> App <$> toExpression f <*> toExpression x     NegApp _x e _ -> toExpression e >>= \ x -> case x of-      Literal (Rational n) -> return $ Literal (Rational $ negate n)+      Literal (Rational n) -> return $ Literal (Rational $ '-' : n)       Literal (Integer n) -> return $ Literal (Integer $ negate n)       _ -> fail "NegApp"     HsPar _x e -> Parentheses <$> toExpression e@@ -244,21 +244,20 @@     HsIsString _ str -> toExpression str  instance ToExpression FractionalLit where-  toExpression fl = toExpression (fl_value fl)--#if __GLASGOW_HASKELL__ >= 902-fl_value :: FractionalLit -> Rational-fl_value = rationalFromFractionalLit+  toExpression fl = case fl_text fl of+#if __GLASGOW_HASKELL__ > 802+    REJECT(NoSourceText)+    SourceText n+#else+    n #endif+      -> return . Literal $ Rational n  instance ToExpression FastString where   toExpression = return . Literal . String . unpackFS  instance ToExpression Integer where   toExpression = return . Literal . Integer--instance ToExpression Rational where-  toExpression = return . Literal . Rational  instance ToExpression Char where   toExpression = return . Literal . Char
src/Test/Hspec/Core/Formatters/Pretty/Parser/Types.hs view
@@ -17,5 +17,5 @@     Char Char   | String String   | Integer Integer-  | Rational Rational+  | Rational String   deriving (Eq, Show)
src/Test/Hspec/Core/Runner.hs view
@@ -54,7 +54,7 @@ import qualified Test.QuickCheck as QC  import           Test.Hspec.Core.Util (Path)-import           Test.Hspec.Core.Spec+import           Test.Hspec.Core.Spec hiding (pruneTree, pruneForest) import           Test.Hspec.Core.Config import           Test.Hspec.Core.Format (FormatConfig(..)) import qualified Test.Hspec.Core.Formatters.V1 as V1@@ -64,9 +64,11 @@ import           Test.Hspec.Core.Shuffle  import           Test.Hspec.Core.Runner.PrintSlowSpecItems-import           Test.Hspec.Core.Runner.Eval+import           Test.Hspec.Core.Runner.Eval hiding (Tree(..))+import qualified Test.Hspec.Core.Runner.Eval as Eval -applyFilterPredicates :: Config -> [EvalTree] -> [EvalTree]++applyFilterPredicates :: Config -> [Tree c EvalItem] -> [Tree c EvalItem] applyFilterPredicates c = filterForestWithLabels p   where     include :: Path -> Bool@@ -80,7 +82,7 @@       where         path = (groups, evalItemDescription item) -applyDryRun :: Config -> [EvalTree] -> [EvalTree]+applyDryRun :: Config -> [EvalItemTree] -> [EvalItemTree] applyDryRun c   | configDryRun c = bimapForest removeCleanup markSuccess   | otherwise = id@@ -220,13 +222,14 @@     Nothing -> getDefaultConcurrentJobs     Just n -> return n -  useColor <- colorOutputSupported (configColorMode config) (hSupportsANSI stdout)+  (reportProgress, useColor) <- colorOutputSupported (configColorMode config) (hSupportsANSI stdout)   outputUnicode <- unicodeOutputSupported (configUnicodeMode config) stdout -  results <- withHiddenCursor useColor stdout $ do+  results <- withHiddenCursor reportProgress stdout $ do     let       formatConfig = FormatConfig {         formatConfigUseColor = useColor+      , formatConfigReportProgress = reportProgress       , formatConfigOutputUnicode = outputUnicode       , formatConfigUseDiff = configDiff config       , formatConfigPrettyPrint = configPrettyPrint config@@ -262,11 +265,11 @@ specToEvalForest config =       failFocusedItems config   >>> focusSpec config-  >>> toEvalForest params+  >>> toEvalItemForest params   >>> applyDryRun config   >>> applyFilterPredicates config-  >>> pruneForest   >>> randomize+  >>> pruneForest   where     seed = (fromJust . configQuickCheckSeed) config     params = Params (configQuickCheckArgs config) (configSmallCheckDepth config)@@ -274,9 +277,22 @@       | configRandomize config = randomizeForest seed       | otherwise = id -toEvalForest :: Params -> [SpecTree ()] -> [EvalTree]-toEvalForest params = bimapForest withUnit toEvalItem . filterForest itemIsFocused+pruneForest :: [Tree c a] -> [Eval.Tree c a]+pruneForest = mapMaybe pruneTree++pruneTree :: Tree c a -> Maybe (Eval.Tree c a)+pruneTree node = case node of+  Node group xs -> Eval.Node group <$> prune xs+  NodeWithCleanup loc action xs -> Eval.NodeWithCleanup loc action <$> prune xs+  Leaf item -> Just (Eval.Leaf item)   where+    prune = nonEmpty . pruneForest++type EvalItemTree = Tree (IO ()) EvalItem++toEvalItemForest :: Params -> [SpecTree ()] -> [EvalItemTree]+toEvalItemForest params = bimapForest withUnit toEvalItem . filterForest itemIsFocused+  where     toEvalItem :: Item () -> EvalItem     toEvalItem (Item requirement loc isParallelizable _isFocused e) = EvalItem requirement loc (fromMaybe False isParallelizable) (e params withUnit) @@ -301,21 +317,31 @@   | useColor  = E.bracket_ (hHideCursor h) (hShowCursor h)   | otherwise = id -colorOutputSupported :: ColorMode -> IO Bool -> IO Bool-colorOutputSupported mode isTerminalDevice = case mode of-  ColorAuto  -> (&&) <$> (not <$> noColor) <*> isTerminalDevice-  ColorNever -> return False-  ColorAlways -> return True+colorOutputSupported :: ColorMode -> IO Bool -> IO (Bool, Bool)+colorOutputSupported mode isTerminalDevice = do+  github <- githubActions+  useColor <- case mode of+    ColorAuto  -> (github ||) <$> colorTerminal+    ColorNever -> return False+    ColorAlways -> return True+  let reportProgress = not github && useColor+  return (reportProgress, useColor)+  where+    githubActions :: IO Bool+    githubActions = lookupEnv "GITHUB_ACTIONS" <&> (== Just "true") +    colorTerminal :: IO Bool+    colorTerminal = (&&) <$> (not <$> noColor) <*> isTerminalDevice++    noColor :: IO Bool+    noColor = lookupEnv "NO_COLOR" <&> (/= Nothing)+ unicodeOutputSupported :: UnicodeMode -> Handle -> IO Bool unicodeOutputSupported mode h = case mode of   UnicodeAuto -> (== Just "UTF-8") . fmap show <$> hGetEncoding h   UnicodeNever -> return False   UnicodeAlways -> return True -noColor :: IO Bool-noColor = lookupEnv "NO_COLOR" <&> (/= Nothing)- rerunAll :: Config -> Maybe FailureReport -> Summary -> Bool rerunAll _ Nothing _ = False rerunAll config (Just oldFailureReport) summary =@@ -348,5 +374,5 @@   ref <- newSTRef (mkStdGen $ fromIntegral seed)   shuffleForest ref t -countSpecItems :: [EvalTree] -> Int+countSpecItems :: [Eval.Tree c a] -> Int countSpecItems = getSum . foldMap (foldMap . const $ Sum 1)
src/Test/Hspec/Core/Runner/Eval.hs view
@@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ConstraintKinds #-}@@ -12,7 +14,10 @@  module Test.Hspec.Core.Runner.Eval (   EvalConfig(..)+, NonEmpty(..)+, nonEmpty , EvalTree+, Tree(..) , EvalItem(..) , runFormatter , resultItemIsFailure@@ -36,13 +41,28 @@ import           Control.Monad.Trans.Class  import           Test.Hspec.Core.Util-import           Test.Hspec.Core.Spec (Tree(..), Progress, FailureReason(..), Result(..), ResultStatus(..), ProgressCallback)+import           Test.Hspec.Core.Spec (Progress, FailureReason(..), Result(..), ResultStatus(..), ProgressCallback) import           Test.Hspec.Core.Timer import           Test.Hspec.Core.Format (Format) import qualified Test.Hspec.Core.Format as Format import           Test.Hspec.Core.Clock import           Test.Hspec.Core.Example.Location import           Test.Hspec.Core.Example (safeEvaluate)++data NonEmpty a = a :| [a]+  deriving (Eq, Show, Functor, Foldable, Traversable)++infixr 5 :|++nonEmpty :: [a] -> Maybe (NonEmpty a)+nonEmpty []     = Nothing+nonEmpty (a:as) = Just (a :| as)++data Tree c a =+    Node String (NonEmpty (Tree c a))+  | NodeWithCleanup (Maybe Location) c (NonEmpty (Tree c a))+  | Leaf a+  deriving (Eq, Show, Functor, Foldable, Traversable)  -- for compatibility with GHC < 7.10.1 type Monad m = (Functor m, Applicative m, M.Monad m)
src/Test/Hspec/Core/Tree.hs view
@@ -17,8 +17,8 @@ , filterForest , filterTreeWithLabels , filterForestWithLabels-, pruneTree-, pruneForest+, pruneTree -- unused+, pruneForest -- unused , location ) where @@ -35,9 +35,9 @@     Node String [Tree c a]   | NodeWithCleanup (Maybe Location) c [Tree c a]   | Leaf a-  deriving (Show, Eq, Functor, Foldable, Traversable)+  deriving (Eq, Show, Functor, Foldable, Traversable) --- | A tree is used to represent a spec internally.  The tree is parametrize+-- | A tree is used to represent a spec internally.  The tree is parameterized -- over the type of cleanup actions and the type of the actual spec items. type SpecTree a = Tree (ActionWith a) (Item a) 
test/Helper.hs view
@@ -27,6 +27,10 @@ , shouldUseArgs  , removeLocations++, (</>)+, mkLocation+, workaroundForIssue19236 ) where  import           Prelude ()@@ -39,6 +43,7 @@ import           Control.Exception import           System.IO.Silently import           System.SetEnv+import           System.FilePath import           System.Directory import           System.IO.Temp @@ -50,7 +55,8 @@ import qualified Test.Hspec.Core.Runner as H import           Test.Hspec.Core.QuickCheckUtil (mkGen) import           Test.Hspec.Core.Clock-import           Test.Hspec.Core.Example (Result(..), ResultStatus(..), FailureReason(..))+import           Test.Hspec.Core.Example (Result(..), ResultStatus(..), FailureReason(..), Location(..))+import           Test.Hspec.Core.Example.Location (workaroundForIssue19236) import           Test.Hspec.Core.Util import qualified Test.Hspec.Core.Format as Format @@ -145,3 +151,10 @@   bracket getCurrentDirectory setCurrentDirectory $ \_ -> do     setCurrentDirectory path     action++mkLocation :: FilePath -> Int -> Int -> Maybe Location+#if MIN_VERSION_base(4,8,1)+mkLocation file line column = Just (Location (workaroundForIssue19236 file) line column)+#else+mkLocation _ _ _ = Nothing+#endif
test/Spec.hs view
@@ -4,11 +4,10 @@ import           Helper  import           Test.Hspec.Meta-import           System.SetEnv import qualified All  spec :: Spec-spec = beforeAll_ (setEnv "IGNORE_DOT_HSPEC" "yes" >> unsetEnv "HSPEC_OPTIONS") $ afterAll_ (unsetEnv "IGNORE_DOT_HSPEC") All.spec+spec = aroundAll_ (withEnvironment [("IGNORE_DOT_HSPEC", "yes")]) All.spec  main :: IO () main = hspec spec
test/Test/Hspec/Core/ConfigSpec.hs view
@@ -1,10 +1,10 @@+{-# LANGUAGE CPP #-} module Test.Hspec.Core.ConfigSpec (spec) where  import           Prelude () import           Helper  import           System.Directory-import           System.FilePath  import           Test.Hspec.Core.Config @@ -26,6 +26,7 @@       writeFile name "--diff"       readConfigFiles `shouldReturn` [(name, ["--diff"])] +#ifndef mingw32_HOST_OS     it "reads ~/.hspec" $ do       let name = "my-home/.hspec"       createDirectory "my-home"@@ -42,3 +43,4 @@         dir <- getCurrentDirectory         removeDirectory dir         readConfigFiles `shouldReturn` []+#endif
test/Test/Hspec/Core/Example/LocationSpec.hs view
@@ -36,7 +36,7 @@     context "with pattern match failure in do expression" $ do       context "in IO" $ do         it "extracts Location" $ do-          let location = Just $ Location __FILE__ (__LINE__ + 2) 13+          let location = Just $ Location file (__LINE__ + 2) 13           Left e <- try $ do             Just n <- return Nothing             return (n :: Int)@@ -45,7 +45,7 @@ #if !MIN_VERSION_base(4,12,0)       context "in Either" $ do         it "extracts Location" $ do-          let location = Just $ Location __FILE__ (__LINE__ + 4) 15+          let location = Just $ Location file (__LINE__ + 4) 15           let             foo :: Either () ()             foo = do@@ -60,7 +60,7 @@         let           location = #if MIN_VERSION_base(4,9,0)-            Just $ Location __FILE__ (__LINE__ + 4) 34+            Just $ Location file (__LINE__ + 4) 34 #else             Nothing #endif@@ -71,13 +71,13 @@       context "with single-line source span" $ do         it "extracts Location" $ do           let-            location = Just $ Location __FILE__ (__LINE__ + 1) 40+            location = Just $ Location file (__LINE__ + 1) 40           Left e <- try (evaluate (let Just n = Nothing in (n :: Int)))           extractLocation e `shouldBe` location        context "with multi-line source span" $ do         it "extracts Location" $ do-          let location = Just $ Location __FILE__ (__LINE__ + 1) 36+          let location = Just $ Location file (__LINE__ + 1) 36           Left e <- try (evaluate (case Nothing of             Just n -> n :: Int             ))@@ -86,19 +86,19 @@     context "with RecConError" $ do       it "extracts Location" $ do         let-          location = Just $ Location __FILE__ (__LINE__ + 1) 39+          location = Just $ Location file (__LINE__ + 1) 39         Left e <- try $ evaluate (age Person {name = "foo"})         extractLocation e `shouldBe` location      context "with NoMethodError" $ do       it "extracts Location" $ do         Left e <- try $ someMethod ()-        extractLocation e `shouldBe` Just (Location __FILE__ 21 10)+        extractLocation e `shouldBe` Just (Location file 21 10)      context "with AssertionFailed" $ do       it "extracts Location" $ do         let-          location = Just $ Location __FILE__ (__LINE__ + 1) 36+          location = Just $ Location file (__LINE__ + 1) 36         Left e <- try . evaluate $ assert False ()         extractLocation e `shouldBe` location @@ -109,15 +109,18 @@             , "  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err"             , "  undefined, called at test/Test/Hspec.hs:13:32 in main:Test.Hspec"             ]-      parseCallStack input `shouldBe` Just (Location "test/Test/Hspec.hs" 13 32)+      parseCallStack input `shouldBe` Just (Location ("test" </> "Test" </> "Hspec.hs") 13 32)    describe "parseLocation" $ do     it "parses Location" $ do-      parseLocation "test/Test/Hspec.hs:13:32" `shouldBe` Just (Location "test/Test/Hspec.hs" 13 32)+      parseLocation "test/Test/Hspec.hs:13:32" `shouldBe` Just (Location ("test" </> "Test" </> "Hspec.hs") 13 32)    describe "parseSourceSpan" $ do     it "parses single-line source span" $ do-      parseSourceSpan "test/Test/Hspec.hs:25:36-51:" `shouldBe` Just (Location "test/Test/Hspec.hs" 25 36)+      parseSourceSpan "test/Test/Hspec.hs:25:36-51:" `shouldBe` Just (Location ("test" </> "Test" </> "Hspec.hs") 25 36)      it "parses multi-line source span" $ do-      parseSourceSpan "test/Test/Hspec.hs:(15,7)-(17,26):" `shouldBe` Just (Location "test/Test/Hspec.hs" 15 7)+      parseSourceSpan "test/Test/Hspec.hs:(15,7)-(17,26):" `shouldBe` Just (Location ("test" </> "Test" </> "Hspec.hs") 15 7)++file :: FilePath+file = workaroundForIssue19236 __FILE__
test/Test/Hspec/Core/ExampleSpec.hs view
@@ -10,11 +10,7 @@ import           Control.Exception import           Test.HUnit (assertFailure, assertEqual) -import           Test.Hspec.Core.Example (Result(..), ResultStatus(..)-#if MIN_VERSION_base(4,8,1)-  , Location(..)-#endif-  , FailureReason(..))+import           Test.Hspec.Core.Example (Result(..), ResultStatus(..), FailureReason(..)) import qualified Test.Hspec.Expectations as H import qualified Test.Hspec.Core.Example as H import qualified Test.Hspec.Core.Spec as H@@ -43,23 +39,13 @@       context "when used with `pending`" $ do         it "returns Pending" $ do           result <- safeEvaluateExample (H.pending)-          let location =-#if MIN_VERSION_base(4,8,1)-                Just $ Location __FILE__ (__LINE__ - 3) 42-#else-                Nothing-#endif+          let location = mkLocation __FILE__ (pred __LINE__) 42           result `shouldBe` Result "" (Pending location Nothing)        context "when used with `pendingWith`" $ do         it "includes the optional reason" $ do           result <- safeEvaluateExample (H.pendingWith "foo")-          let location =-#if MIN_VERSION_base(4,8,1)-                Just $ Location __FILE__ (__LINE__ - 3) 42-#else-                Nothing-#endif+          let location = mkLocation __FILE__ (pred __LINE__) 42           result `shouldBe` Result "" (Pending location $ Just "foo")    describe "evaluateExample" $ do@@ -198,22 +184,12 @@        context "when used with `pending`" $ do         it "returns Pending" $ do-          let location =-#if MIN_VERSION_base(4,8,1)-                Just $ Location __FILE__ (__LINE__ + 4) 37-#else-                Nothing-#endif+          let location = mkLocation __FILE__ (succ __LINE__) 37           evaluateExample (property H.pending) `shouldReturn` Result "" (Pending location Nothing)        context "when used with `pendingWith`" $ do         it "includes the optional reason" $ do-          let location =-#if MIN_VERSION_base(4,8,1)-                Just $ Location __FILE__ (__LINE__ + 4) 39-#else-                Nothing-#endif+          let location = mkLocation __FILE__ (succ __LINE__) 39           evaluateExample (property $ H.pendingWith "foo") `shouldReturn` Result "" (Pending location $ Just "foo")    describe "Expectation" $ do
test/Test/Hspec/Core/Formatters/Pretty/ParserSpec.hs view
@@ -34,10 +34,10 @@       parse "-23" `shouldBe` just (integer (-23))      it "parses rationals" $ do-      parse "23.0" `shouldBe` just (Literal $ Rational 23)+      parse "23.0" `shouldBe` just (Literal $ Rational "23.0")      it "parses negative rationals" $ do-      parse "-23.0" `shouldBe` just (Literal $ Rational (-23))+      parse "-23.0" `shouldBe` just (Literal $ Rational "-23.0")      it "parses lists" $ do       parse (show ["foo", "bar", "baz"]) `shouldBe` just (List [string "foo", string "bar", string "baz"])
test/Test/Hspec/Core/Formatters/PrettySpec.hs view
@@ -58,11 +58,11 @@         ]      it "pretty-prints tuples" $ do-      pretty True (show (person, 23 :: Int)) `shouldBe` just [+      pretty True (show (person, 23 :: Double)) `shouldBe` just [           "(Person {"         , "  personName = \"Joe\","         , "  personAge = 23"-        , "}, 23)"+        , "}, 23.0)"         ]      it "pretty-prints lists" $ do
test/Test/Hspec/Core/Formatters/V2Spec.hs view
@@ -24,6 +24,7 @@ formatConfig :: FormatConfig formatConfig = FormatConfig {   formatConfigUseColor = False+, formatConfigReportProgress = False , formatConfigOutputUnicode = True , formatConfigUseDiff = True , formatConfigPrettyPrint = True
test/Test/Hspec/Core/Runner/EvalSpec.hs view
@@ -3,16 +3,19 @@ import           Prelude () import           Helper -import           Test.Hspec.Core.Tree import           Test.Hspec.Core.Runner.Eval +fromList :: [a] -> NonEmpty a+fromList (a:as) = a :| as+fromList [] = error "NonEmpty.fromList: empty list"+ spec :: Spec spec = do   describe "traverse" $ do     context "when used with Tree" $ do       let         tree :: Tree () Int-        tree = Node "" [Node "" [Leaf 1, Node "" [Leaf 2, Leaf 3]], Leaf 4]+        tree = Node "" $ fromList [Node "" $ fromList [Leaf 1, Node "" $ fromList [Leaf 2, Leaf 3]], Leaf 4]       it "walks the tree left-to-right, depth-first" $ do         ref <- newIORef []         traverse_ (modifyIORef ref . (:) ) tree
test/Test/Hspec/Core/RunnerSpec.hs view
@@ -425,7 +425,7 @@           , ""           , "Slow spec items:" #if MIN_VERSION_base(4,8,1)-          , "  test/Test/Hspec/Core/RunnerSpec.hs:418:11: /foo/ (2ms)"+          , "  test" </> "Test" </> "Hspec" </> "Core" </> "RunnerSpec.hs:418:11: /foo/ (2ms)" #else           , "  /foo/ (2ms)" #endif@@ -576,22 +576,32 @@         high `shouldBe` j    describe "colorOutputSupported" $ do-    it "returns False" $ do-      withEnvironment [] $ do-        H.colorOutputSupported H.ColorAuto (return False) `shouldReturn` False +    context "without a terminal device" $ do++      let isTerminalDevice = return False++      it "returns False" $ do+        H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` (False, False)++      context "with GITHUB_ACTIONS=true" $ do+        it "returns True" $ do+          withEnvironment [("GITHUB_ACTIONS", "true")] $ do+            H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` (False, True)+     context "with a terminal device" $ do+       let isTerminalDevice = return True+       it "returns True" $ do-        withEnvironment [] $ do-          H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` True+        H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` (True, True)        context "when NO_COLOR is set" $ do         it "returns False" $ do           withEnvironment [("NO_COLOR", "yes")] $ do-            H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` False+            H.colorOutputSupported H.ColorAuto isTerminalDevice `shouldReturn` (False, False) -  describe "colorOutputSupported" $ do+  describe "unicodeOutputSupported" $ do     context "with UnicodeAlways" $ do       it "returns True" $ do         H.unicodeOutputSupported H.UnicodeAlways undefined `shouldReturn` True
test/Test/Hspec/Core/SpecSpec.hs view
@@ -53,12 +53,7 @@      it "adds source locations" $ do       [Leaf item] <- runSpecM (H.it "foo" True)-      let location =-#if MIN_VERSION_base(4,8,1)-            Just $ H.Location __FILE__ (__LINE__ - 3) 32-#else-            Nothing-#endif+      let location = mkLocation __FILE__ (pred __LINE__) 32       itemLocation item `shouldBe` location      context "when no description is given" $ do
version.yaml view
@@ -1,1 +1,1 @@-&version 2.9.4+&version 2.9.5