doctest 0.9.3 → 0.9.4
raw patch · 4 files changed
+39/−16 lines, 4 filesdep +base-compatdep +setenvdep ~HUnitdep ~basedep ~ghcPVP ok
version bump matches the API change (PVP)
Dependencies added: base-compat, setenv
Dependency ranges changed: HUnit, base, ghc, ghc-paths, silently, stringbuilder
API changes (from Hackage documentation)
Files
- doctest.cabal +16/−14
- src/Help.hs +2/−0
- src/Interpreter.hs +1/−0
- src/Run.hs +20/−2
doctest.cabal view
@@ -1,5 +1,5 @@ name: doctest-version: 0.9.3+version: 0.9.4 synopsis: Test interactive Haskell examples description: The doctest program checks examples in source code comments. It is modeled after doctest for Python@@ -45,14 +45,14 @@ , Run , Util build-depends:- base >= 4.0 && < 4.7- , ghc >= 6.12 && < 7.8+ base == 4.*+ , ghc >= 6.12 && < 7.8 , syb , deepseq , directory , filepath , process- , ghc-paths == 0.1.*+ , ghc-paths == 0.1.* , transformers executable doctest@@ -63,7 +63,7 @@ hs-source-dirs: driver build-depends:- base >= 4.0 && < 4.7+ base == 4.* , doctest test-suite spec@@ -80,20 +80,22 @@ c-sources: test/integration/with-cbits/foo.c build-depends:- base >= 4.0 && < 4.7- , ghc >= 6.12 && < 7.8+ base-compat >= 0.2.1+ , ghc , syb , deepseq , directory+ , filepath , process- , ghc-paths == 0.1.*+ , ghc-paths , transformers- , HUnit == 1.2.*- , hspec >= 1.3- , QuickCheck >= 2.5- , stringbuilder >= 0.2- , silently- , filepath++ , HUnit+ , hspec >= 1.3+ , QuickCheck >= 2.5+ , stringbuilder >= 0.4+ , silently >= 1.2.4+ , setenv test-suite doctests main-is:
src/Help.hs view
@@ -6,6 +6,7 @@ import Paths_doctest (version) import Data.Version (showVersion) import Config as GHC+import Interpreter (ghc) usage :: String usage = unlines [@@ -23,3 +24,4 @@ printVersion = do putStrLn ("doctest version " ++ showVersion version) putStrLn ("using version " ++ GHC.cProjectVersion ++ " of the GHC API")+ putStrLn ("using " ++ ghc)
src/Interpreter.hs view
@@ -3,6 +3,7 @@ , eval , safeEval , withInterpreter+, ghc ) where import System.IO
src/Run.hs view
@@ -12,7 +12,9 @@ import Control.Monad (when) import System.Exit (exitFailure) import System.IO+import System.Environment (getEnvironment) +import Control.Applicative import qualified Control.Exception as E import Panic @@ -21,6 +23,13 @@ import Report import qualified Interpreter +ghcPackageDbFlag :: String+#if __GLASGOW_HASKELL__ >= 706+ghcPackageDbFlag = "-package-db"+#else+ghcPackageDbFlag = "-package-conf"+#endif+ -- | Run doctest with given list of arguments. -- -- Example:@@ -35,17 +44,26 @@ | "--help" `elem` args = putStr usage | "--version" `elem` args = printVersion | otherwise = do+ -- 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.+ packageConf <- lookup "HASKELL_PACKAGE_SANDBOX" <$> getEnvironment+ let addPackageConf = case packageConf of+ Nothing -> id+ Just p -> \rest -> ghcPackageDbFlag : p : rest+ let (f, args_) = stripOptGhc args when f $ do hPutStrLn stderr "WARNING: --optghc is deprecated, doctest now accepts arbitrary GHC options\ndirectly." hFlush stderr- r <- doctest_ args_ `E.catch` \e -> do+ r <- doctest_ (addPackageConf args_) `E.catch` \e -> do case fromException e of Just (UsageError err) -> do hPutStrLn stderr ("doctest: " ++ err) hPutStrLn stderr "Try `doctest --help' for more information." exitFailure- _ -> E.throw e+ _ -> E.throwIO e when (not $ isSuccess r) exitFailure isSuccess :: Summary -> Bool