Hello community, here is the log from the commit of package ghc-mockery for openSUSE:Factory checked in at 2016-11-10 13:29:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-mockery (Old) and /work/SRC/openSUSE:Factory/.ghc-mockery.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-mockery" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-mockery/ghc-mockery.changes 2016-11-03 11:13:31.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-mockery.new/ghc-mockery.changes 2016-11-10 13:29:58.000000000 +0100 @@ -1,0 +2,5 @@ +Sun Oct 30 16:26:42 UTC 2016 - [email protected] + +- Update to version 0.3.4 with cabal2obs. + +------------------------------------------------------------------- Old: ---- mockery-0.3.3.tar.gz New: ---- mockery-0.3.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-mockery.spec ++++++ --- /var/tmp/diff_new_pack.M6T9xT/_old 2016-11-10 13:29:59.000000000 +0100 +++ /var/tmp/diff_new_pack.M6T9xT/_new 2016-11-10 13:29:59.000000000 +0100 @@ -19,15 +19,14 @@ %global pkg_name mockery %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.3.3 +Version: 0.3.4 Release: 0 Summary: Support functions for automated testing License: MIT -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: BuildRequires: ghc-base-compat-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-directory-devel @@ -39,7 +38,6 @@ %if %{with tests} BuildRequires: ghc-hspec-devel %endif -# End cabal-rpm deps %description Support functions for automated testing. @@ -58,20 +56,14 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %check -%if %{with tests} -%{cabal} test -%endif - +%cabal_test %post devel %ghc_pkg_recache ++++++ mockery-0.3.3.tar.gz -> mockery-0.3.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockery-0.3.3/LICENSE new/mockery-0.3.4/LICENSE --- old/mockery-0.3.3/LICENSE 2016-03-23 02:45:52.000000000 +0100 +++ new/mockery-0.3.4/LICENSE 2016-10-30 05:01:07.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2015 Simon Hengel <[email protected]> +Copyright (c) 2015-2016 Simon Hengel <[email protected]> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockery-0.3.3/mockery.cabal new/mockery-0.3.4/mockery.cabal --- old/mockery-0.3.3/mockery.cabal 2016-03-23 02:45:52.000000000 +0100 +++ new/mockery-0.3.4/mockery.cabal 2016-10-30 05:01:07.000000000 +0100 @@ -1,16 +1,16 @@ --- This file has been generated from package.yaml by hpack version 0.11.0. +-- This file has been generated from package.yaml by hpack version 0.15.0. -- -- see: https://github.com/sol/hpack name: mockery -version: 0.3.3 +version: 0.3.4 synopsis: Support functions for automated testing description: Support functions for automated testing category: Testing bug-reports: https://github.com/hspec/mockery/issues author: Simon Hengel <[email protected]> maintainer: Simon Hengel <[email protected]> -copyright: (c) 2015 Simon Hengel +copyright: (c) 2015-2016 Simon Hengel license: MIT license-file: LICENSE build-type: Simple diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockery-0.3.3/src/Test/Mockery/Environment.hs new/mockery-0.3.4/src/Test/Mockery/Environment.hs --- old/mockery-0.3.3/src/Test/Mockery/Environment.hs 2016-03-23 02:45:52.000000000 +0100 +++ new/mockery-0.3.4/src/Test/Mockery/Environment.hs 2016-10-30 05:01:07.000000000 +0100 @@ -1,31 +1,53 @@ -module Test.Mockery.Environment (withEnvironment) where +module Test.Mockery.Environment ( + withEnvironment +, withModifiedEnvironment +) where import Control.Exception.Base import Control.Monad import System.Environment.Compat -- | --- Run the given action with the specified environment. +-- Run the given action within the specified environment. -- --- Before executing the action, `withEnvironment` backs up the current environment, --- clears out the environment, and then applies the supplied environment. +-- Before executing the action, `withEnvironment` backs up the current +-- environment, clears out the environment, and then applies the supplied +-- environment. -- After the action has completed the original environment is restored. --- __Note__: The environment is global for a process, so tests that depend on the +-- +-- __Note__: The environment is global to a process, so tests that modify the -- environment can no longer be run in parallel. withEnvironment :: [(String, String)] -> IO a -> IO a -withEnvironment environment action = bracket saveEnv restoreEnv $ const action - where - saveEnv :: IO [(String, String)] - saveEnv = do - env <- clearEnv - forM_ environment $ uncurry setEnv - return env - restoreEnv :: [(String, String)] -> IO () - restoreEnv env = do - _ <- clearEnv - forM_ env $ uncurry setEnv - clearEnv :: IO [(String, String)] - clearEnv = do - env <- getEnvironment - forM_ env (unsetEnv . fst) - return env +withEnvironment environment action = bracketEnvironment $ do + setEnvironment environment + action + +-- | +-- Run the given action within an augmented environment. +-- +-- Before executing the action, `withModifiedEnvironment` backs up the current +-- environment and then augments it with the supplied values. +-- After the action has completed the original environment is restored. +-- +-- __Note__: The environment is global to a process, so tests that modify the +-- environment can no longer be run in parallel. +withModifiedEnvironment :: [(String, String)] -> IO a -> IO a +withModifiedEnvironment environment action = bracketEnvironment $ do + modifyEnvironment environment + action + +bracketEnvironment :: IO a -> IO a +bracketEnvironment = bracket getEnvironment setEnvironment . const + +setEnvironment :: [(String, String)] -> IO () +setEnvironment environment = do + clearEnvironment + modifyEnvironment environment + +modifyEnvironment :: [(String, String)] -> IO () +modifyEnvironment environment = forM_ environment $ uncurry setEnv + +clearEnvironment :: IO () +clearEnvironment = do + environment <- getEnvironment + forM_ environment (unsetEnv . fst) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockery-0.3.3/test/Test/Mockery/EnvironmentSpec.hs new/mockery-0.3.4/test/Test/Mockery/EnvironmentSpec.hs --- old/mockery-0.3.3/test/Test/Mockery/EnvironmentSpec.hs 2016-03-23 02:45:52.000000000 +0100 +++ new/mockery-0.3.4/test/Test/Mockery/EnvironmentSpec.hs 2016-10-30 05:01:07.000000000 +0100 @@ -6,19 +6,29 @@ import Test.Mockery.Environment spec :: Spec -spec = describe "withEnvironment" $ do - it "hides the environment" $ do - withEnvironment [("foo", "bar")] $ do - env <- getEnvironment - env `shouldMatchList` [("foo", "bar")] - it "restores the environment" $ do - oldEnv <- getEnvironment - withEnvironment [("foo", "bar")] $ do - return () - newEnv <- getEnvironment - newEnv `shouldMatchList` oldEnv - it "should allow the environment to be modified" $ do - withEnvironment [] $ do - setEnv "foo2" "bar2" - var <- lookupEnv "foo2" - var `shouldBe` Just "bar2" +spec = do + describe "withEnvironment" $ do + it "runs the given action within the specified environment" $ do + withEnvironment [("foo", "bar")] $ do + getEnvironment `shouldReturn` [("foo", "bar")] + + it "restores the original environment" $ do + old <- getEnvironment + withEnvironment [("foo", "bar")] $ do + return () + new <- getEnvironment + new `shouldMatchList` old + + describe "withModifiedEnvironment" $ do + it "runs the given action within a modified environment" $ do + original <- getEnvironment + withModifiedEnvironment [("foo", "bar")] $ do + modified <- getEnvironment + modified `shouldMatchList` original ++ [("foo", "bar")] + + it "restores the original environment" $ do + old <- getEnvironment + withModifiedEnvironment [("foo", "bar")] $ do + return () + new <- getEnvironment + new `shouldMatchList` old
