Hello community, here is the log from the commit of package ghc-hspec-core for openSUSE:Factory checked in at 2017-04-14 13:38:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-hspec-core (Old) and /work/SRC/openSUSE:Factory/.ghc-hspec-core.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hspec-core" Fri Apr 14 13:38:08 2017 rev:3 rq:485133 version:2.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-hspec-core/ghc-hspec-core.changes 2017-03-20 17:07:07.686496855 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-hspec-core.new/ghc-hspec-core.changes 2017-04-14 13:38:11.931339803 +0200 @@ -1,0 +2,5 @@ +Mon Mar 27 12:41:16 UTC 2017 - [email protected] + +- Update to version 2.4.3 with cabal2obs. + +------------------------------------------------------------------- Old: ---- hspec-core-2.4.2.tar.gz New: ---- hspec-core-2.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-hspec-core.spec ++++++ --- /var/tmp/diff_new_pack.bDVRNG/_old 2017-04-14 13:38:14.243013096 +0200 +++ /var/tmp/diff_new_pack.bDVRNG/_new 2017-04-14 13:38:14.243013096 +0200 @@ -19,7 +19,7 @@ %global pkg_name hspec-core %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.4.2 +Version: 2.4.3 Release: 0 Summary: A Testing Framework for Haskell License: MIT ++++++ hspec-core-2.4.2.tar.gz -> hspec-core-2.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/hspec-core.cabal new/hspec-core-2.4.3/hspec-core.cabal --- old/hspec-core-2.4.2/hspec-core.cabal 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/hspec-core.cabal 2017-03-25 12:27:37.000000000 +0100 @@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: hspec-core -version: 2.4.2 +version: 2.4.3 license: MIT license-file: LICENSE copyright: (c) 2011-2017 Simon Hengel, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/src/Test/Hspec/Core/Compat.hs new/hspec-core-2.4.3/src/Test/Hspec/Core/Compat.hs --- old/hspec-core-2.4.2/src/Test/Hspec/Core/Compat.hs 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/src/Test/Hspec/Core/Compat.hs 2017-03-25 12:27:37.000000000 +0100 @@ -51,7 +51,7 @@ import Data.IORef import System.Environment -import Data.Typeable.Internal (tyConModule, tyConName) +import Data.Typeable (tyConModule, tyConName) import Control.Concurrent #if !MIN_VERSION_base(4,6,0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/src/Test/Hspec/Core/Config.hs new/hspec-core-2.4.3/src/Test/Hspec/Core/Config.hs --- old/hspec-core-2.4.2/src/Test/Hspec/Core/Config.hs 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/src/Test/Hspec/Core/Config.hs 2017-03-25 12:27:37.000000000 +0100 @@ -11,7 +11,8 @@ #endif ) where -import Control.Applicative +import Prelude () + import Control.Exception import Control.Monad import Data.Maybe @@ -23,6 +24,7 @@ import qualified Test.QuickCheck as QC import Test.Hspec.Core.Util +import Test.Hspec.Core.Compat import Test.Hspec.Core.Options import Test.Hspec.Core.FailureReport import Test.Hspec.Core.QuickCheckUtil (mkGen) @@ -85,7 +87,8 @@ case ignore of True -> return [] False -> readConfigFiles - case parseOptions opts_ prog configFiles args of + envVar <- fmap words <$> lookupEnv envVarName + case parseOptions opts_ prog configFiles envVar args of Left (err, msg) -> exitWithMessage err msg Right opts -> do r <- if configRerun opts then readFailureReport opts else return Nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/src/Test/Hspec/Core/Options.hs new/hspec-core-2.4.3/src/Test/Hspec/Core/Options.hs --- old/hspec-core-2.4.2/src/Test/Hspec/Core/Options.hs 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/src/Test/Hspec/Core/Options.hs 2017-03-25 12:27:37.000000000 +0100 @@ -6,6 +6,7 @@ , parseOptions , ConfigFile , ignoreConfigFile +, envVarName ) where import Prelude () @@ -20,9 +21,15 @@ import Test.Hspec.Core.Util import Test.Hspec.Core.Example (Params(..), defaultParams) import Data.Functor.Identity +import Data.Maybe type ConfigFile = (FilePath, [String]) +type EnvVar = [String] + +envVarName :: String +envVarName = "HSPEC_OPTIONS" + data Config = Config { configIgnoreConfigFile :: Bool , configDryRun :: Bool @@ -225,9 +232,11 @@ recognizedOptions :: [OptDescr (Result Maybe -> Result Maybe)] recognizedOptions = documentedOptions ++ undocumentedOptions -parseOptions :: Config -> String -> [ConfigFile] -> [String] -> Either (ExitCode, String) Config -parseOptions config prog configFiles args = do - foldM (parseFileOptions prog) config configFiles >>= parseCommandLineOptions prog args +parseOptions :: Config -> String -> [ConfigFile] -> Maybe EnvVar -> [String] -> Either (ExitCode, String) Config +parseOptions config prog configFiles envVar args = do + foldM (parseFileOptions prog) config configFiles + >>= parseEnvVarOptions prog envVar + >>= parseCommandLineOptions prog args parseCommandLineOptions :: String -> [String] -> Config -> Either (ExitCode, String) Config parseCommandLineOptions prog args config = case parse recognizedOptions config args of @@ -238,21 +247,28 @@ failure err = Left (ExitFailure 1, prog ++ ": " ++ err ++ "\nTry `" ++ prog ++ " --help' for more information.\n") parseFileOptions :: String -> Config -> ConfigFile -> Either (ExitCode, String) Config -parseFileOptions prog config (name, args) = case parse configFileOptions config args of +parseFileOptions prog config (name, args) = + parseOtherOptions prog ("in config file " ++ name) args config + +parseEnvVarOptions :: String -> (Maybe EnvVar) -> Config -> Either (ExitCode, String) Config +parseEnvVarOptions prog args = + parseOtherOptions prog ("from environment variable " ++ envVarName) (fromMaybe [] args) + +parseOtherOptions :: String -> String -> [String] -> Config -> Either (ExitCode, String) Config +parseOtherOptions prog source args config = case parse configFileOptions config args of Right (Identity c) -> Right c Left err -> failure err where failure err = Left (ExitFailure 1, prog ++ ": " ++ message) where message = unlines $ case lines err of - [x] -> [x ++ " " ++ inFile] - xs -> xs ++ [inFile] - inFile = "in config file " ++ name + [x] -> [x ++ " " ++ source] + xs -> xs ++ [source] parse :: Monad m => [OptDescr (Result m -> Result m)] -> Config -> [String] -> Either String (m Config) parse options config args = case getOpt Permute options args of (opts, [], []) -> case foldl' (flip id) (Right $ return config) opts of - Left (InvalidArgument flag value) -> Left ("invalid argument `" ++ value ++ "' for `--" ++ flag ++ "'") + Left (InvalidArgument name value) -> Left ("invalid argument `" ++ value ++ "' for `--" ++ name ++ "'") Right x -> Right x (_, _, err:_) -> Left (init err) (_, arg:_, _) -> Left ("unexpected argument `" ++ arg ++ "'") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/test/Test/Hspec/Core/OptionsSpec.hs new/hspec-core-2.4.3/test/Test/Hspec/Core/OptionsSpec.hs --- old/hspec-core-2.4.2/test/Test/Hspec/Core/OptionsSpec.hs 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/test/Test/Hspec/Core/OptionsSpec.hs 2017-03-25 12:27:37.000000000 +0100 @@ -18,58 +18,58 @@ let parseOptions = Options.parseOptions defaultConfig "my-spec" it "rejects unexpected arguments" $ do - fromLeft (parseOptions [] ["foo"]) `shouldBe` (ExitFailure 1, "my-spec: unexpected argument `foo'\nTry `my-spec --help' for more information.\n") + fromLeft (parseOptions [] Nothing ["foo"]) `shouldBe` (ExitFailure 1, "my-spec: unexpected argument `foo'\nTry `my-spec --help' for more information.\n") it "rejects unrecognized options" $ do - fromLeft (parseOptions [] ["--foo"]) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--foo'\nTry `my-spec --help' for more information.\n") + fromLeft (parseOptions [] Nothing ["--foo"]) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--foo'\nTry `my-spec --help' for more information.\n") it "sets configColorMode to ColorAuto" $ do - configColorMode <$> parseOptions [] [] `shouldBe` Right ColorAuto + configColorMode <$> parseOptions [] Nothing [] `shouldBe` Right ColorAuto context "with --no-color" $ do it "sets configColorMode to ColorNever" $ do - configColorMode <$> parseOptions [] ["--no-color"] `shouldBe` Right ColorNever + configColorMode <$> parseOptions [] Nothing ["--no-color"] `shouldBe` Right ColorNever context "with --color" $ do it "sets configColorMode to ColorAlways" $ do - configColorMode <$> parseOptions [] ["--color"] `shouldBe` Right ColorAlways + configColorMode <$> parseOptions [] Nothing ["--color"] `shouldBe` Right ColorAlways context "with --out" $ do it "sets configOutputFile" $ do - either (const Nothing) Just . configOutputFile <$> parseOptions [] ["--out", "foo"] `shouldBe` Right (Just "foo") + either (const Nothing) Just . configOutputFile <$> parseOptions [] Nothing ["--out", "foo"] `shouldBe` Right (Just "foo") context "with --qc-max-success" $ do context "when given an invalid argument" $ do it "returns an error message" $ do - fromLeft (parseOptions [] ["--qc-max-success", "foo"]) `shouldBe` (ExitFailure 1, "my-spec: invalid argument `foo' for `--qc-max-success'\nTry `my-spec --help' for more information.\n") + fromLeft (parseOptions [] Nothing ["--qc-max-success", "foo"]) `shouldBe` (ExitFailure 1, "my-spec: invalid argument `foo' for `--qc-max-success'\nTry `my-spec --help' for more information.\n") context "with --depth" $ do it "sets depth parameter for SmallCheck" $ do - configSmallCheckDepth <$> parseOptions [] ["--depth", "23"] `shouldBe` Right 23 + configSmallCheckDepth <$> parseOptions [] Nothing ["--depth", "23"] `shouldBe` Right 23 context "with --jobs" $ do it "sets number of concurrent jobs" $ do - configConcurrentJobs <$> parseOptions [] ["--jobs=23"] `shouldBe` Right (Just 23) + configConcurrentJobs <$> parseOptions [] Nothing ["--jobs=23"] `shouldBe` Right (Just 23) it "rejects values < 1" $ do let msg = "my-spec: invalid argument `0' for `--jobs'\nTry `my-spec --help' for more information.\n" - void (parseOptions [] ["--jobs=0"]) `shouldBe` Left (ExitFailure 1, msg) + void (parseOptions [] Nothing ["--jobs=0"]) `shouldBe` Left (ExitFailure 1, msg) context "when given a config file" $ do it "uses options from config file" $ do - configColorMode <$> parseOptions [("~/.hspec", ["--no-color"])] [] `shouldBe` Right ColorNever + configColorMode <$> parseOptions [("~/.hspec", ["--no-color"])] Nothing [] `shouldBe` Right ColorNever it "gives command-line options precedence" $ do - configColorMode <$> parseOptions [("~/.hspec", ["--no-color"])] ["--color"] `shouldBe` Right ColorAlways + configColorMode <$> parseOptions [("~/.hspec", ["--no-color"])] Nothing ["--color"] `shouldBe` Right ColorAlways it "rejects --help" $ do - fromLeft (parseOptions [("~/.hspec", ["--help"])] []) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--help' in config file ~/.hspec\n") + fromLeft (parseOptions [("~/.hspec", ["--help"])] Nothing []) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--help' in config file ~/.hspec\n") it "rejects unrecognized options" $ do - fromLeft (parseOptions [("~/.hspec", ["--invalid"])] []) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--invalid' in config file ~/.hspec\n") + fromLeft (parseOptions [("~/.hspec", ["--invalid"])] Nothing []) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--invalid' in config file ~/.hspec\n") it "rejects ambiguous options" $ do - fromLeft (parseOptions [("~/.hspec", ["--qc-max-s"])] []) `shouldBe` (ExitFailure 1, + fromLeft (parseOptions [("~/.hspec", ["--qc-max-s"])] Nothing []) `shouldBe` (ExitFailure 1, unlines [ "my-spec: option `--qc-max-s' is ambiguous; could be one of:" , " -a N --qc-max-success=N maximum number of successful tests" @@ -81,7 +81,17 @@ context "when given multiple config files" $ do it "gives later config files precedence" $ do - configColorMode <$> parseOptions [("~/.hspec", ["--no-color"]), (".hspec", ["--color"])] [] `shouldBe` Right ColorAlways + configColorMode <$> parseOptions [("~/.hspec", ["--no-color"]), (".hspec", ["--color"])] Nothing [] `shouldBe` Right ColorAlways + + context "when given an environment variable" $ do + it "uses options from environment variable" $ do + configColorMode <$> parseOptions [] (Just ["--no-color"]) [] `shouldBe` Right ColorNever + + it "gives command-line options precedence" $ do + configColorMode <$> parseOptions [] (Just ["--no-color"]) ["--color"] `shouldBe` Right ColorAlways + + it "rejects unrecognized options" $ do + fromLeft (parseOptions [] (Just ["--invalid"]) []) `shouldBe` (ExitFailure 1, "my-spec: unrecognized option `--invalid' from environment variable HSPEC_OPTIONS\n") describe "ignoreConfigFile" $ around_ (withEnvironment []) $ do context "by default" $ do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hspec-core-2.4.2/test/Test/Hspec/Core/RunnerSpec.hs new/hspec-core-2.4.3/test/Test/Hspec/Core/RunnerSpec.hs --- old/hspec-core-2.4.2/test/Test/Hspec/Core/RunnerSpec.hs 2017-02-24 08:46:45.000000000 +0100 +++ new/hspec-core-2.4.3/test/Test/Hspec/Core/RunnerSpec.hs 2017-03-25 12:27:37.000000000 +0100 @@ -103,9 +103,9 @@ r <- runPropFoo ["--seed", "42"] runPropFoo ["--rerun"] `shouldReturn` r - forM_ quickCheckOptions $ \(flag, accessor) -> do - it ("reuses same " ++ flag) $ do - [flag, "23"] `shouldUseArgs` ((== 23) . accessor) + forM_ quickCheckOptions $ \(name, accessor) -> do + it ("reuses same " ++ name) $ do + [name, "23"] `shouldUseArgs` ((== 23) . accessor) ["--rerun"] `shouldUseArgs` ((== 23) . accessor) context "when no examples failed previously" $ do @@ -144,7 +144,7 @@ r `shouldBe` "WARNING: Could not read environment variable HSPEC_FAILURES; `--rerun' is ignored!\n" - it "does not leak command-line flags to examples" $ do + it "does not leak command-line options to examples" $ do silence . withArgs ["--verbose"] $ do H.hspec $ do H.it "foobar" $ do
