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
d32d1458
Commit
d32d1458
authored
May 04, 2016
by
Edward Z. Yang
Browse files
Accumulate environment in 'withEnv'.
Signed-off-by:
Edward Z. Yang
<
ezyang@cs.stanford.edu
>
parent
be218c72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Program/Run.hs
View file @
d32d1458
...
...
@@ -193,6 +193,8 @@ getExtraPathEnv env extras = do
return
[(
"PATH"
,
Just
path'
)]
-- | Return the current environment extended with the given overrides.
-- If an entry is specified twice in @overrides@, the second entry takes
-- precedence.
--
getEffectiveEnvironment
::
[(
String
,
Maybe
String
)]
->
NoCallStackIO
(
Maybe
[(
String
,
String
)])
...
...
Cabal/tests/PackageTests/PackageTester.hs
View file @
d32d1458
...
...
@@ -669,14 +669,11 @@ whenGhcVersion p m = do
withPackage
::
FilePath
->
TestM
a
->
TestM
a
withPackage
f
=
withReaderT
(
\
(
suite
,
test
)
->
(
suite
,
test
{
testCurrentPackage
=
f
}))
--
TODO: Really should accumulate... but I think to do this
--
properly we can't just append
--
We append to the environment list, as per 'getEffectiveEnvironment'
--
which prefers the latest override.
withEnv
::
[(
String
,
Maybe
String
)]
->
TestM
a
->
TestM
a
withEnv
e
m
=
do
(
_
,
test0
)
<-
ask
when
(
not
(
null
(
testEnvironment
test0
)))
$
error
"nested withEnv (not yet) supported"
withReaderT
(
\
(
suite
,
test
)
->
(
suite
,
test
{
testEnvironment
=
e
}))
m
withReaderT
(
\
(
suite
,
test
)
->
(
suite
,
test
{
testEnvironment
=
testEnvironment
test
++
e
}))
m
withPackageDb
::
TestM
a
->
TestM
a
withPackageDb
m
=
do
...
...
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