Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-hspec-core for openSUSE:Factory 
checked in at 2021-01-20 18:25:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hspec-core (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-hspec-core.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-hspec-core"

Wed Jan 20 18:25:19 2021 rev:16 rq:863269 version:2.7.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-hspec-core/ghc-hspec-core.changes    
2020-12-22 11:40:46.677580008 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-hspec-core.new.28504/ghc-hspec-core.changes 
2021-01-20 18:25:48.951425962 +0100
@@ -1,0 +2,12 @@
+Fri Jan  8 08:27:03 UTC 2021 - [email protected]
+
+- Update hspec-core to version 2.7.6.
+  Upstream does not provide a change log file.
+
+-------------------------------------------------------------------
+Mon Jan  4 11:06:53 UTC 2021 - [email protected]
+
+- Update hspec-core to version 2.7.5.
+  Upstream does not provide a change log file.
+
+-------------------------------------------------------------------

Old:
----
  hspec-core-2.7.4.tar.gz

New:
----
  hspec-core-2.7.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-hspec-core.spec ++++++
--- /var/tmp/diff_new_pack.iIiUx4/_old  2021-01-20 18:25:49.683426659 +0100
+++ /var/tmp/diff_new_pack.iIiUx4/_new  2021-01-20 18:25:49.687426663 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-hspec-core
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name hspec-core
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.7.4
+Version:        2.7.6
 Release:        0
 Summary:        A Testing Framework for Haskell
 License:        MIT

++++++ hspec-core-2.7.4.tar.gz -> hspec-core-2.7.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/LICENSE new/hspec-core-2.7.6/LICENSE
--- old/hspec-core-2.7.4/LICENSE        2020-09-01 14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/LICENSE        2001-09-09 03:46:40.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2019 Simon Hengel <[email protected]>
+Copyright (c) 2011-2021 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.7.4/hspec-core.cabal 
new/hspec-core-2.7.6/hspec-core.cabal
--- old/hspec-core-2.7.4/hspec-core.cabal       2020-09-01 14:11:21.000000000 
+0200
+++ new/hspec-core-2.7.6/hspec-core.cabal       2001-09-09 03:46:40.000000000 
+0200
@@ -1,18 +1,20 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.34.2.
+-- This file has been generated from package.yaml by hpack version 0.34.3.
 --
 -- see: https://github.com/sol/hpack
 
 name:             hspec-core
-version:          2.7.4
+version:          2.7.6
 license:          MIT
 license-file:     LICENSE
-copyright:        (c) 2011-2019 Simon Hengel,
+copyright:        (c) 2011-2021 Simon Hengel,
                   (c) 2011-2012 Trystan Spangler,
                   (c) 2011 Greg Weber
 maintainer:       Simon Hengel <[email protected]>
 build-type:       Simple
+extra-source-files:
+    version.yaml
 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.7.4/src/Test/Hspec/Core/Example/Location.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Example/Location.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Example/Location.hs        
2020-09-01 14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Example/Location.hs        
2001-09-09 03:46:40.000000000 +0200
@@ -4,6 +4,7 @@
 , extractLocation
 
 -- for testing
+, parseAssertionFailed
 , parseCallStack
 , parseLocation
 , parseSourceSpan
@@ -31,6 +32,21 @@
   <|> locationFromPatternMatchFail e
   <|> locationFromRecConError e
   <|> locationFromIOException e
+  <|> locationFromNoMethodError e
+  <|> locationFromAssertionFailed e
+
+locationFromNoMethodError :: SomeException -> Maybe Location
+locationFromNoMethodError e = case fromException e of
+  Just (NoMethodError s) -> listToMaybe (words s) >>= parseSourceSpan
+  Nothing -> Nothing
+
+locationFromAssertionFailed :: SomeException -> Maybe Location
+locationFromAssertionFailed e = case fromException e of
+  Just (AssertionFailed loc) -> parseAssertionFailed loc
+  Nothing -> Nothing
+
+parseAssertionFailed :: String -> Maybe Location
+parseAssertionFailed loc = parseCallStack loc <|> parseSourceSpan loc
 
 locationFromErrorCall :: SomeException -> Maybe Location
 locationFromErrorCall e = case fromException e of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/src/Test/Hspec/Core/Formatters.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Formatters.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Formatters.hs      2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Formatters.hs      2001-09-09 
03:46:40.000000000 +0200
@@ -3,7 +3,7 @@
 -- Stability: experimental
 --
 -- This module contains formatters that can be used with
--- `Test.Hspec.Runner.hspecWith`.
+-- `Test.Hspec.Core.Runner.hspecWith`.
 module Test.Hspec.Core.Formatters (
 
 -- * Formatters
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/src/Test/Hspec/Core/Hooks.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Hooks.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Hooks.hs   2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Hooks.hs   2001-09-09 
03:46:40.000000000 +0200
@@ -5,6 +5,7 @@
 , beforeWith
 , beforeAll
 , beforeAll_
+, beforeAllWith
 , after
 , after_
 , afterAll
@@ -45,6 +46,12 @@
   mvar <- runIO (newMVar Empty)
   before_ (memoize mvar action) spec
 
+-- | Run a custom action with an argument before the first spec item.
+beforeAllWith :: (b -> IO a) -> SpecWith a -> SpecWith b
+beforeAllWith action spec = do
+  mvar <- runIO (newMVar Empty)
+  beforeWith (memoize mvar . action) spec
+
 data Memoized a =
     Empty
   | Memoized a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/src/Test/Hspec/Core/Runner.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Runner.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Runner.hs  2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Runner.hs  2001-09-09 
03:46:40.000000000 +0200
@@ -57,9 +57,6 @@
 
 import           Test.Hspec.Core.Runner.Eval
 
--- | Filter specs by given predicate.
---
--- The predicate takes a list of "describe" labels and a "requirement".
 filterSpecs :: Config -> [EvalTree] -> [EvalTree]
 filterSpecs c = go []
   where
@@ -81,19 +78,16 @@
       Node group specs -> goSpecs (groups ++ [group]) specs (Node group)
       NodeWithCleanup action specs -> goSpecs groups specs (NodeWithCleanup 
action)
 
-applyDryRun :: Config -> [SpecTree ()] -> [SpecTree ()]
+applyDryRun :: Config -> [EvalTree] -> [EvalTree]
 applyDryRun c
-  | configDryRun c = map (removeCleanup . fmap markSuccess)
+  | configDryRun c = bimapForest removeCleanup markSuccess
   | otherwise = id
   where
-    markSuccess :: Item () -> Item ()
-    markSuccess item = item {itemExample = safeEvaluateExample (Result "" 
Success)}
+    removeCleanup :: IO () -> IO ()
+    removeCleanup _ = return ()
 
-    removeCleanup :: SpecTree () -> SpecTree ()
-    removeCleanup spec = case spec of
-      Node x xs -> Node x (map removeCleanup xs)
-      NodeWithCleanup _ xs -> NodeWithCleanup (\() -> return ()) (map 
removeCleanup xs)
-      leaf@(Leaf _) -> leaf
+    markSuccess :: EvalItem -> EvalItem
+    markSuccess item = item {evalItemAction = \ _ -> return $ Result "" 
Success}
 
 -- | Run a given spec and write a report to `stdout`.
 -- Exit with `exitFailure` if at least one spec item fails.
@@ -227,7 +221,7 @@
         | configRandomize config = randomizeForest seed
         | otherwise = id
 
-    filteredSpec <- randomize . filterSpecs config . mapMaybe (toEvalTree 
params) . applyDryRun config <$> runSpecM focusedSpec
+    filteredSpec <- randomize . filterSpecs config . applyDryRun config . 
toEvalForest params <$> runSpecM focusedSpec
 
     (total, failures) <- withHiddenCursor useColor h $ do
       let
@@ -249,15 +243,14 @@
     dumpFailureReport config seed qcArgs failures
     return (Summary total (length failures))
 
-toEvalTree :: Params -> SpecTree () -> Maybe EvalTree
-toEvalTree params = go
+toEvalForest :: Params -> [SpecTree ()] -> [EvalTree]
+toEvalForest params = bimapForest withUnit toEvalItem . filterForest 
itemIsFocused
   where
-    go :: Tree (() -> c) (Item ()) -> Maybe (Tree c EvalItem)
-    go t = case t of
-      Node s xs -> Just $ Node s (mapMaybe go xs)
-      NodeWithCleanup c xs -> Just $ NodeWithCleanup (c ()) (mapMaybe go xs)
-      Leaf (Item requirement loc isParallelizable isFocused e) ->
-        guard isFocused >> return (Leaf (EvalItem requirement loc (fromMaybe 
False isParallelizable) (e params $ ($ ()))))
+    toEvalItem :: Item () -> EvalItem
+    toEvalItem (Item requirement loc isParallelizable _isFocused e) = EvalItem 
requirement loc (fromMaybe False isParallelizable) (e params withUnit)
+
+    withUnit :: ActionWith () -> IO ()
+    withUnit action = action ()
 
 dumpFailureReport :: Config -> Integer -> QC.Args -> [Path] -> IO ()
 dumpFailureReport config seed qcArgs xs = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/src/Test/Hspec/Core/Spec.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Spec.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Spec.hs    2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Spec.hs    2001-09-09 
03:46:40.000000000 +0200
@@ -108,7 +108,7 @@
   let
     ys
       | any (any itemIsFocused) xs = xs
-      | otherwise = map (bimapTree id (\ item -> item {itemIsFocused = True})) 
xs
+      | otherwise = bimapForest id (\ item -> item {itemIsFocused = True}) xs
   fromSpecList ys
 
 -- | @fit@ is an alias for @fmap focus . it@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/src/Test/Hspec/Core/Tree.hs 
new/hspec-core-2.7.6/src/Test/Hspec/Core/Tree.hs
--- old/hspec-core-2.7.4/src/Test/Hspec/Core/Tree.hs    2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/src/Test/Hspec/Core/Tree.hs    2001-09-09 
03:46:40.000000000 +0200
@@ -13,6 +13,9 @@
 , specGroup
 , specItem
 , bimapTree
+, bimapForest
+, filterTree
+, filterForest
 , location
 ) where
 
@@ -35,6 +38,9 @@
 -- over the type of cleanup actions and the type of the actual spec items.
 type SpecTree a = Tree (ActionWith a) (Item a)
 
+bimapForest :: (a -> b) -> (c -> d) -> [Tree a c] -> [Tree b d]
+bimapForest g f = map (bimapTree g f)
+
 bimapTree :: (a -> b) -> (c -> d) -> Tree a c -> Tree b d
 bimapTree g f = go
   where
@@ -43,6 +49,15 @@
       NodeWithCleanup cleanup xs -> NodeWithCleanup (g cleanup) (map go xs)
       Leaf item -> Leaf (f item)
 
+filterForest :: (a -> Bool) -> [Tree c a] -> [Tree c a]
+filterForest = mapMaybe . filterTree
+
+filterTree :: (a -> Bool) -> Tree c a -> Maybe (Tree c a)
+filterTree p t = case t of
+  Node s xs -> Just $ Node s (filterForest p xs)
+  NodeWithCleanup c xs -> Just $ NodeWithCleanup c (filterForest p xs)
+  leaf@(Leaf a) -> guard (p a) >> return leaf
+
 -- |
 -- @Item@ is used to represent spec items internally.  A spec item consists of:
 --
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/test/Helper.hs 
new/hspec-core-2.7.6/test/Helper.hs
--- old/hspec-core-2.7.4/test/Helper.hs 2020-09-01 14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/test/Helper.hs 2001-09-09 03:46:40.000000000 +0200
@@ -68,7 +68,7 @@
   (==) = exceptionEq
 
 throwException :: IO ()
-throwException = E.throwIO (E.ErrorCall "foobar")
+throwException = E.throwIO DivideByZero
 
 ignoreExitCode :: IO () -> IO ()
 ignoreExitCode action = action `E.catch` \e -> let _ = e :: ExitCode in return 
()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/test/Spec.hs 
new/hspec-core-2.7.6/test/Spec.hs
--- old/hspec-core-2.7.4/test/Spec.hs   2020-09-01 14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/test/Spec.hs   2001-09-09 03:46:40.000000000 +0200
@@ -5,7 +5,7 @@
 import qualified All
 
 spec :: Spec
-spec = beforeAll_ (setEnv "IGNORE_DOT_HSPEC" "yes") $ afterAll_ (unsetEnv 
"IGNORE_DOT_HSPEC") All.spec
+spec = beforeAll_ (setEnv "IGNORE_DOT_HSPEC" "yes" >> unsetEnv 
"HSPEC_OPTIONS") $ afterAll_ (unsetEnv "IGNORE_DOT_HSPEC") All.spec
 
 main :: IO ()
 main = hspec spec
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hspec-core-2.7.4/test/Test/Hspec/Core/Example/LocationSpec.hs 
new/hspec-core-2.7.6/test/Test/Hspec/Core/Example/LocationSpec.hs
--- old/hspec-core-2.7.4/test/Test/Hspec/Core/Example/LocationSpec.hs   
2020-09-01 14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/test/Test/Hspec/Core/Example/LocationSpec.hs   
2001-09-09 03:46:40.000000000 +0200
@@ -2,6 +2,8 @@
 {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
 {-# OPTIONS_GHC -fno-warn-missing-fields #-}
 {-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
+{-# OPTIONS_GHC -fno-warn-missing-methods #-}
+{-# OPTIONS_GHC -O0 #-}
 module Test.Hspec.Core.Example.LocationSpec (spec) where
 
 import           Helper
@@ -10,6 +12,11 @@
 import           Test.Hspec.Core.Example
 import           Test.Hspec.Core.Example.Location
 
+class SomeClass a where
+    someMethod :: a -> IO ()
+
+instance SomeClass () where
+
 data Person = Person {
   name :: String
 , age :: Int
@@ -17,6 +24,11 @@
 
 spec :: Spec
 spec = do
+  describe "parseAssertionFailed" $ do
+    context "with pre-GHC-8.* error message" $ do
+      it "extracts source location" $ do
+        parseAssertionFailed "Foo.hs:4:7-12: Assertion failed\n" `shouldBe` 
Just (Location "Foo.hs" 4 7)
+
   describe "extractLocation" $ do
     context "with pattern match failure in do expression" $ do
       context "in IO" $ do
@@ -75,6 +87,18 @@
         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__ 18 10)
+
+    context "with AssertionFailed" $ do
+      it "extracts Location" $ do
+        let
+          location = Just $ Location __FILE__ (__LINE__ + 1) 36
+        Left e <- try . evaluate $ assert False ()
+        extractLocation e `shouldBe` location
+
   describe "parseCallStack" $ do
     it "parses Location from call stack" $ do
       let input = unlines [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/test/Test/Hspec/Core/HooksSpec.hs 
new/hspec-core-2.7.6/test/Test/Hspec/Core/HooksSpec.hs
--- old/hspec-core-2.7.4/test/Test/Hspec/Core/HooksSpec.hs      2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/test/Test/Hspec/Core/HooksSpec.hs      2001-09-09 
03:46:40.000000000 +0200
@@ -155,6 +155,66 @@
           , "bar"
           ]
 
+  describe "beforeAllWith" $ do
+    it "transforms the spec argument" $ do
+      (rec, retrieve) <- mkAppend
+      let action :: Int -> IO String
+          action = return . show
+      runSilent $ H.beforeAll (return 23) $ H.beforeAllWith action $ do
+        H.it "foo" $ \value -> rec value
+      retrieve `shouldReturn` ["23"]
+
+    it "can be used multiple times" $ do
+      let action1 :: Int -> IO Int
+          action1 = return . succ
+
+          action2 :: Int -> IO String
+          action2 = return . show
+
+          action3 :: String -> IO String
+          action3 = return . ("foo " ++)
+
+      (rec, retrieve) <- mkAppend
+
+      runSilent $ H.beforeAll (return 23) $
+        H.beforeAllWith action1 $ H.beforeAllWith action2 $ H.beforeAllWith 
action3 $ do
+          H.it "foo" $ \value -> rec value
+
+      retrieve `shouldReturn` ["foo 24"]
+
+    it "runs an action before the first spec item" $ do
+      (rec, retrieve) <- mkAppend
+      runSilent $ H.beforeAll (return (23 :: Int)) $
+        H.beforeAllWith (\value -> rec "beforeAllWith" >> return (show value)) 
$ do
+          H.it "foo" $ \value -> do
+            rec $ "foo " ++ value
+          H.it "bar" $ \value -> do
+            rec $ "bar " ++ value
+      retrieve `shouldReturn` [
+          "beforeAllWith"
+        , "foo 23"
+        , "bar 23"
+        ]
+
+    context "when specified action throws an exception" $ do
+      it "sets subsequent spec items to pending" $ do
+        result <- silence . H.hspecResult $
+          H.beforeAll (return (23 :: Int)) $
+            H.beforeAllWith (\_ -> throwIO (ErrorCall "foo")) $ do
+              H.it "foo" $ \n -> do
+                n `shouldBe` (23 :: Int)
+              H.it "bar" $ \n -> do
+                n `shouldBe` 23
+        result `shouldBe` H.Summary {H.summaryExamples = 2, H.summaryFailures 
= 1}
+
+    context "when used with an empty list of examples" $ do
+      it "does not run specified action" $ do
+        (rec, retrieve) <- mkAppend
+        runSilent $ H.beforeAll (return (23 :: Int)) $
+          H.beforeAllWith (\_ -> rec "beforeAllWith" >> return "value") $ do
+            return ()
+        retrieve `shouldReturn` []
+
   describe "after" $ do
     it "runs an action after every spec item" $ do
       (rec, retrieve) <- mkAppend
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/test/Test/Hspec/Core/UtilSpec.hs 
new/hspec-core-2.7.6/test/Test/Hspec/Core/UtilSpec.hs
--- old/hspec-core-2.7.4/test/Test/Hspec/Core/UtilSpec.hs       2020-09-01 
14:11:21.000000000 +0200
+++ new/hspec-core-2.7.6/test/Test/Hspec/Core/UtilSpec.hs       2001-09-09 
03:46:40.000000000 +0200
@@ -49,7 +49,7 @@
 
     it "returns Left on exception" $ do
       Left e <- safeTry throwException
-      show e `shouldBe` "foobar"
+      E.fromException e `shouldBe` Just E.DivideByZero
 
     it "evaluates result to weak head normal form" $ do
       Left e <- safeTry (return $ E.throw $ E.ErrorCall "foo")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-core-2.7.4/version.yaml 
new/hspec-core-2.7.6/version.yaml
--- old/hspec-core-2.7.4/version.yaml   1970-01-01 01:00:00.000000000 +0100
+++ new/hspec-core-2.7.6/version.yaml   2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1 @@
+&version 2.7.6

Reply via email to