doctest 0.24.1 → 0.24.2
raw patch · 10 files changed
+17/−77 lines, 10 filesdep ~basedep ~ghcPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, ghc
API changes (from Hackage documentation)
Files
- CHANGES.markdown +3/−0
- LICENSE +1/−1
- doctest.cabal +9/−9
- src/Extract.hs +0/−33
- src/GhcUtil.hs +0/−8
- src/Imports.hs +0/−6
- src/Interpreter.hs +0/−2
- src/Run.hs +2/−6
- src/Runner.hs +1/−6
- test/Language/Haskell/GhciWrapperSpec.hs +1/−6
CHANGES.markdown view
@@ -1,3 +1,6 @@+Changes in 0.24.2+ - Use `GHC.ResponseFile.expandResponse`+ Changes in 0.24.1 - Interpret GHC response files
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2009-2024 Simon Hengel <sol@typeful.net>+Copyright (c) 2009-2025 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
doctest.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.38.0.+-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack name: doctest-version: 0.24.1+version: 0.24.2 synopsis: Test interactive Haskell examples description: `doctest` is a tool that checks [examples](https://www.haskell.org/haddock/doc/html/ch03s08.html#idm140354810775744) and [properties](https://www.haskell.org/haddock/doc/html/ch03s08.html#idm140354810771856)@@ -18,7 +18,7 @@ homepage: https://github.com/sol/doctest#readme license: MIT license-file: LICENSE-copyright: (c) 2009-2024 Simon Hengel+copyright: (c) 2009-2025 Simon Hengel author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net> build-type: Simple@@ -154,14 +154,14 @@ Util Paths_doctest build-depends:- base >=4.7 && <5+ base >=4.12 && <5 , code-page >=0.1 , containers , deepseq , directory , exceptions , filepath- , ghc >=8.0 && <9.14+ , ghc >=8.6 && <9.14 , ghc-paths >=0.1.0.9 , process , syb >=0.3@@ -184,7 +184,7 @@ NoImplicitPrelude ghc-options: -Wall -threaded build-depends:- base >=4.7 && <5+ base >=4.12 && <5 , doctest default-language: Haskell2010 if impl(ghc >= 9.0)@@ -207,7 +207,7 @@ DeriveFunctor NoImplicitPrelude build-depends:- base >=4.7 && <5+ base >=4.12 && <5 , doctest default-language: Haskell2010 if impl(ghc >= 9.0)@@ -279,14 +279,14 @@ build-depends: HUnit , QuickCheck >=2.13.1- , base >=4.7 && <5+ , base >=4.12 && <5 , code-page >=0.1 , containers , deepseq , directory , exceptions , filepath- , ghc >=8.0 && <9.14+ , ghc >=8.6 && <9.14 , ghc-paths >=0.1.0.9 , hspec >=2.3.0 , hspec-core >=2.3.0
src/Extract.hs view
@@ -29,10 +29,6 @@ import System.Directory import System.FilePath -#if __GLASGOW_HASKELL__ < 805-import FastString (unpackFS)-#endif- import System.Posix.Internals (c_getpid) import GhcUtil (withGhc)@@ -41,13 +37,11 @@ import Util (convertDosLineEndings) import PackageDBs (getPackageDBArgs) -#if __GLASGOW_HASKELL__ >= 806 #if __GLASGOW_HASKELL__ < 900 import DynamicLoading (initializePlugins) #else import GHC.Runtime.Loader (initializePlugins) #endif-#endif #if __GLASGOW_HASKELL__ >= 901 import GHC.Unit.Module.Graph@@ -87,15 +81,6 @@ instance NFData a => NFData (Module a) where rnf (Module name setup content) = name `deepseq` setup `deepseq` content `deepseq` () -#if __GLASGOW_HASKELL__ < 803-type GhcPs = RdrName-#endif--#if __GLASGOW_HASKELL__ < 805-addQuoteInclude :: [String] -> [String] -> [String]-addQuoteInclude includes new = new ++ includes-#endif- -- | Parse a list of modules. parse :: [String] -> IO [ParsedModule] parse args = withGhc args $ \modules_ -> withTempOutputDir $ do@@ -156,7 +141,6 @@ , includePaths = addQuoteInclude (includePaths d) [f] } -#if __GLASGOW_HASKELL__ >= 806 -- Since GHC 8.6, plugins are initialized on a per module basis loadModPlugins modsum = do _ <- setSessionDynFlags (GHC.ms_hspp_opts modsum)@@ -170,9 +154,6 @@ dynflags' <- liftIO (initializePlugins hsc_env (GHC.ms_hspp_opts modsum)) return $ modsum { ms_hspp_opts = dynflags' } # endif-#else- loadModPlugins = return-#endif -- | Extract all docstrings from given list of files/modules. --@@ -241,11 +222,7 @@ #else exports = [ (Nothing, L (locA loc) doc) #endif-#if __GLASGOW_HASKELL__ < 805- | L loc (IEDoc doc) <- maybe [] unLoc (hsmodExports source)-#else | L loc (IEDoc _ doc) <- maybe [] unLoc (hsmodExports source)-#endif ] decls :: [(Maybe String, LHsDocString)] decls = extractDocStrings (hsmodDecls source)@@ -283,11 +260,7 @@ -- Top-level documentation has to be treated separately, because it has -- no location information attached. The location information is -- attached to HsDecl instead.-#if __GLASGOW_HASKELL__ < 805- DocD x-#else DocD _ x-#endif -> select (fromDocDecl (locA loc) x) _ -> (extractDocStrings decl, True)@@ -313,12 +286,6 @@ -- | Collect given value and descend into subtree. select :: a -> ([a], Bool) select x = ([x], False)-#endif--#if __GLASGOW_HASKELL__ < 805--- | Convert a docstring to a plain string.-unpackHDS :: HsDocString -> String-unpackHDS (HsDocString s) = unpackFS s #endif #if __GLASGOW_HASKELL__ < 901
src/GhcUtil.hs view
@@ -25,10 +25,6 @@ import System.Exit (exitFailure) -#if __GLASGOW_HASKELL__ < 801-import StaticFlags (discardStaticFlags)-#endif- -- Catch GHC source errors, print them and exit. handleSrcErrors :: Ghc a -> Ghc a handleSrcErrors action' = flip handleSourceError action' $ \err -> do@@ -44,11 +40,7 @@ handleDynamicFlags flags_ >>= handleSrcErrors . action handleStaticFlags :: [String] -> IO [Located String]-#if __GLASGOW_HASKELL__ < 801-handleStaticFlags flags = return $ map noLoc $ discardStaticFlags flags-#else handleStaticFlags flags = return $ map noLoc $ flags-#endif handleDynamicFlags :: GhcMonad m => [Located String] -> m [String] handleDynamicFlags flags = do
src/Imports.hs view
@@ -14,13 +14,7 @@ import System.Exit import System.Process -#if __GLASGOW_HASKELL__ >= 804 import Data.Functor as Imports ((<&>))-#else-infixl 1 <&>-(<&>) :: Functor f => f a -> (a -> b) -> f b-(<&>) = flip fmap-#endif pass :: Monad m => m () pass = return ()
src/Interpreter.hs view
@@ -46,10 +46,8 @@ let args = flags ++ [ xTemplateHaskell-#if __GLASGOW_HASKELL__ >= 802 , "-fdiagnostics-color=never" , "-fno-diagnostics-show-caret"-#endif #if __GLASGOW_HASKELL__ >= 810 && __GLASGOW_HASKELL__ < 904 , "-Wno-unused-packages" #endif
src/Run.hs view
@@ -23,6 +23,7 @@ import Imports +import GHC.ResponseFile (expandResponse) import System.Directory (doesFileExist, doesDirectoryExist, getDirectoryContents) import System.Environment (getEnvironment) import System.Exit (exitFailure, exitSuccess)@@ -63,7 +64,7 @@ doctest = doctestWithRepl (repl defaultConfig) doctestWithRepl :: (String, [String]) -> [String] -> IO ()-doctestWithRepl repl = interpretResponseFile >=> \ args0 -> case parseOptions args0 of+doctestWithRepl repl = expandResponse >=> \ args0 -> case parseOptions args0 of Options.ProxyToGhc args -> exec Interpreter.ghc args Options.Output s -> putStr s Options.Result (Run warnings magicMode config) -> do@@ -83,11 +84,6 @@ addDistArgs <- getAddDistArgs return (addDistArgs $ packageDBArgs ++ expandedArgs) doctestWith config{repl, ghcOptions = opts}--interpretResponseFile :: [String] -> IO [String]-interpretResponseFile = \ case- ['@':name] -> lines <$> readFile name- args -> return args -- | Expand a reference to a directory to all .hs and .lhs files within it. expandDirs :: String -> IO [String]
src/Runner.hs view
@@ -61,13 +61,8 @@ -- | Sum up summaries. instance Monoid Summary where mempty = Summary 0 0 0 0-#if __GLASGOW_HASKELL__ < 804- mappend-#else instance Semigroup Summary where- (<>)-#endif- (Summary x1 x2 x3 x4) (Summary y1 y2 y3 y4) = Summary (x1 + y1) (x2 + y2) (x3 + y3) (x4 + y4)+ Summary x1 x2 x3 x4 <> Summary y1 y2 y3 y4 = Summary (x1 + y1) (x2 + y2) (x3 + y3) (x4 + y4) withLineBuffering :: Handle -> IO c -> IO c withLineBuffering h action = bracket (hGetBuffering h) (hSetBuffering h) $ \ _ -> do
test/Language/Haskell/GhciWrapperSpec.hs view
@@ -89,13 +89,8 @@ ghci "exitWith $ ExitFailure 10" `shouldReturn` "*** Exception: ExitFailure 10\n" it "gives an error message for identifiers that are not in scope" $ withInterpreter $ \ghci -> do-#if __GLASGOW_HASKELL__ >= 800 ghci "foo" >>= (`shouldSatisfy` isInfixOf "Variable not in scope: foo")-#elif __GLASGOW_HASKELL__ >= 707- ghci "foo" >>= (`shouldSatisfy` isSuffixOf "Not in scope: \8216foo\8217\n")-#else- ghci "foo" >>= (`shouldSatisfy` isSuffixOf "Not in scope: `foo'\n")-#endif+ context "when configVerbose is True" $ do it "prints prompt" $ do withInterpreterConfig defaultConfig{configVerbose = True} [] $ \ghci -> do