Skip to content

Commit

Permalink
Rename PACKAGE_SANDBOX to HASKELL_PACKAGE_SANDBOX (fixes #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Dec 2, 2012
1 parent 44e60ce commit 96d5090
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ doctest args
| "--help" `elem` args = putStr usage
| "--version" `elem` args = printVersion
| otherwise = do
-- Look up the PACKAGE_SANDBOX environment variable and, if present, add
-- it to the list of package databases GHC searches. Intended to make
-- testing from inside sandboxes such as cabal-dev simpler.
-- Look up the HASKELL_PACKAGE_SANDBOX environment variable and, if
-- present, add it to the list of package databases GHC searches.
-- Intended to make testing from inside sandboxes such as cabal-dev
-- simpler.
env <- getEnvironment
let addPackageConf =
case lookup "PACKAGE_SANDBOX" env of
case lookup "HASKELL_PACKAGE_SANDBOX" env of
Nothing -> id
Just p -> \rest -> "-package-conf" : p : rest

Expand Down
4 changes: 2 additions & 2 deletions test/RunSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ spec = do
, "Try `doctest --help' for more information."
]

it "respects PACKAGE_SANDBOX" $ do
it "respects HASKELL_PACKAGE_SANDBOX" $ do
withCurrentDirectory "test/integration/custom-package-conf/foo" $ do
ExitSuccess <- rawSystem "ghc-pkg" ["init", "../packages"]
ExitSuccess <- rawSystem "cabal" ["configure", "--disable-optimization", "--disable-library-profiling", "--package-db=../packages"]
ExitSuccess <- rawSystem "cabal" ["build"]
ExitSuccess <- rawSystem "cabal" ["register", "--inplace"]
return ()

withEnv "PACKAGE_SANDBOX" "test/integration/custom-package-conf/packages" $ do
withEnv "HASKELL_PACKAGE_SANDBOX" "test/integration/custom-package-conf/packages" $ do
hCapture_ [stderr] (doctest ["test/integration/custom-package-conf/Bar.hs"])
`shouldReturn` "Examples: 2 Tried: 2 Errors: 0 Failures: 0\n"

Expand Down

0 comments on commit 96d5090

Please sign in to comment.