Skip to content

Commit

Permalink
Fix for GHC 6.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Nov 6, 2012
1 parent 9b2c8cb commit f794eb9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .ghci
Original file line number Diff line number Diff line change
@@ -1 +1 @@
:set -isrc -itest -optP-include -optPdist/build/autogen/cabal_macros.h
:set -isrc -itest -optP-include -optPdist/build/autogen/cabal_macros.h -XHaskell98
20 changes: 10 additions & 10 deletions hspec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source-repository head
location: https://github.com/hspec/hspec

Library
default-language: Haskell2010
default-language: Haskell98
ghc-options:
-Wall
hs-source-dirs:
Expand All @@ -37,7 +37,7 @@ Library
, silently >= 1.1.1 && < 2
, ansi-terminal == 0.5.5
, time < 1.5
, transformers >= 0.2.0 && < 0.4.0
, transformers >= 0.2.2.0 && < 0.4.0
, HUnit >= 1.2.5
, QuickCheck >= 2.4.0.1 && < 2.6
, hspec-expectations
Expand All @@ -59,7 +59,7 @@ Library
Test.Hspec.Formatters.Internal

test-suite spec
default-language: Haskell2010
default-language: Haskell98
type:
exitcode-stdio-1.0
hs-source-dirs:
Expand All @@ -74,7 +74,7 @@ test-suite spec
, silently >= 1.1.1 && < 2
, ansi-terminal == 0.5.5
, time < 1.5
, transformers >= 0.2.0 && < 0.4.0
, transformers >= 0.2.2.0 && < 0.4.0
, HUnit >= 1.2.5
, QuickCheck >= 2.4.0.1 && < 2.6
, hspec-expectations
Expand All @@ -84,7 +84,7 @@ test-suite spec
, ghc-paths

test-suite doctests
default-language: Haskell2010
default-language: Haskell98
main-is:
doctests.hs
type:
Expand All @@ -98,7 +98,7 @@ test-suite doctests
, doctest >= 0.8

test-suite example
default-language: Haskell2010
default-language: Haskell98
type:
exitcode-stdio-1.0
main-is:
Expand All @@ -114,7 +114,7 @@ test-suite example

-- hspec-discover
executable hspec-discover
default-language: Haskell2010
default-language: Haskell98
ghc-options:
-Wall
hs-source-dirs:
Expand All @@ -129,7 +129,7 @@ executable hspec-discover
, directory

test-suite hspec-discover-spec
default-language: Haskell2010
default-language: Haskell98
type:
exitcode-stdio-1.0
ghc-options:
Expand All @@ -146,7 +146,7 @@ test-suite hspec-discover-spec
, hspec-meta

test-suite hspec-discover-example
default-language: Haskell2010
default-language: Haskell98
type:
exitcode-stdio-1.0
ghc-options:
Expand All @@ -161,7 +161,7 @@ test-suite hspec-discover-example
, QuickCheck

test-suite hspec-discover-integration-test-empty
default-language: Haskell2010
default-language: Haskell98
type:
exitcode-stdio-1.0
ghc-options:
Expand Down
3 changes: 3 additions & 0 deletions src/Test/Hspec/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import Test.Hspec.Formatters
import Test.Hspec.Util
import Test.Hspec.Core.Type (Params (..), defaultParams)

-- Monad (Either e) and base < 4.3
import Control.Monad.Trans.Error ()

data Config = Config {
configVerbose :: Bool
, configReRun :: Bool
Expand Down
5 changes: 1 addition & 4 deletions src/Test/Hspec/Formatters/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ withPendingColor = withColor (SetColor Foreground Dull Yellow) "hspec-pending"
withColor :: SGR -> String -> FormatM a -> FormatM a
withColor color cls action = do
r <- gets produceHTML
if r then
htmlSpan cls action
else
withColor_ color action
(if r then htmlSpan cls else withColor_ color) action

htmlSpan :: String -> FormatM a -> FormatM a
htmlSpan cls action = write ("<span class=\"" ++ cls ++ "\">") *> action <* write "</span>"
Expand Down
3 changes: 1 addition & 2 deletions test/Test/Hspec/RunnerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Test.Hspec.Meta
import System.IO.Silently (hCapture, hSilence)
import System.IO (stderr)
import Control.Applicative
import Control.Monad (void)
import System.Environment (withArgs, withProgName, getArgs)
import System.Exit
import qualified Control.Exception as E
Expand Down Expand Up @@ -182,7 +181,7 @@ spec = do

it "treats uncaught exceptions as failure" $ do
H.hspecWith H.defaultConfig $ do
H.it "foobar" (void . E.throwIO $ E.ErrorCall "foobar")
H.it "foobar" (E.throwIO (E.ErrorCall "foobar") >> pure ())
`shouldReturn` H.Summary 1 1

it "uses the specdoc formatter by default" $ do
Expand Down

0 comments on commit f794eb9

Please sign in to comment.