Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
cb682226
Commit
cb682226
authored
Sep 03, 2016
by
novadenizen
Browse files
Improved exception handling style
parent
c2170ae6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Test/LibV09.hs
View file @
cb682226
...
...
@@ -29,8 +29,7 @@ import Distribution.TestSuite
import
Distribution.Text
import
Distribution.Verbosity
import
Control.Exception
(
bracket
,
catch
,
displayException
,
SomeException
)
import
Control.Exception
(
bracket
,
catch
,
SomeException
,
displayException
)
import
System.Directory
(
createDirectoryIfMissing
,
doesDirectoryExist
,
doesFileExist
,
getCurrentDirectory
,
removeDirectoryRecursive
,
removeFile
...
...
@@ -213,14 +212,14 @@ stubMain :: IO [Test] -> IO ()
stubMain
tests
=
do
(
f
,
n
)
<-
fmap
read
getContents
dir
<-
getCurrentDirectory
let
errhandler
::
SomeException
->
IO
TestLogs
errhandler
e
=
do
return
$
TestLog
{
testName
=
"Cabal test suite exception"
,
testOptionsReturned
=
[]
,
testResult
=
Error
$
displayException
e
}
results
<-
((
tests
>>=
stubRunTests
)
`
catch
`
errhandler
)
setCurrentDirectory
dir
stubWriteLog
f
n
results
where
errhandler
::
SomeException
->
IO
TestLogs
errhandler
e
=
return
$
TestLog
{
testName
=
"Cabal test suite exception"
,
testOptionsReturned
=
[]
,
testResult
=
Error
$
displayException
e
}
-- | The test runner used in library "TestSuite" stub executables. Runs a list
-- of 'Test's. An executable calling this function is meant to be invoked as
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment