doctest 0.22.2 → 0.22.3
raw patch · 12 files changed
+41/−29 lines, 12 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.markdown +3/−0
- LICENSE +1/−1
- README.md +6/−3
- doctest.cabal +5/−5
- src/Extract.hs +12/−6
- src/Imports.hs +1/−0
- src/Language/Haskell/GhciWrapper.hs +0/−1
- src/Parse.hs +0/−1
- src/Property.hs +0/−1
- src/Run.hs +2/−5
- test/Language/Haskell/GhciWrapperSpec.hs +1/−1
- test/RunSpec.hs +10/−5
CHANGES.markdown view
@@ -1,3 +1,6 @@+Changes in 0.22.3+ - Use `-Wno-unused-packages` when extracting comments+ Changes in 0.22.2 - GHC 9.8 compatibility
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2009-2023 Simon Hengel <sol@typeful.net>+Copyright (c) 2009-2024 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
README.md view
@@ -132,6 +132,9 @@ - If you use properties you need to pass `--build-depends=QuickCheck` and `--build-depends=template-haskell` to `cabal repl`. +- You likely want to reset the warning strategy for `cabal repl` with+ `--repl-options='-w -Wdefault'`.+ - `doctest` always uses the version of GHC it was compiled with. Reinstalling `doctest` with `cabal install doctest --overwrite-policy=always` before each invocation ensures that it uses the same version of GHC as is on the `PATH`.@@ -144,7 +147,7 @@ So a more robust way to call `doctest` is as follows: ```-cabal install doctest --overwrite-policy=always && cabal build && cabal repl --build-depends=QuickCheck --build-depends=template-haskell --with-ghc=doctest+cabal install doctest --overwrite-policy=always && cabal build && cabal repl --build-depends=QuickCheck --build-depends=template-haskell --with-ghc=doctest --repl-options='-w -Wdefault' ``` (This is what you want to use on CI.)@@ -430,7 +433,7 @@ ```haskell -- |--- >>> :set -XTupleSections+-- >>> :seti -XTupleSections -- >>> fst' $ (1,) 2 -- 1 fst' :: (a, b) -> a@@ -450,7 +453,7 @@ ```haskell -- $--- >>> :set -XTupleSections+-- >>> :seti -XTupleSections ``` [language-pragma]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/exts/pragmas.html#language-pragma
doctest.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: doctest-version: 0.22.2+version: 0.22.3 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-2023 Simon Hengel+copyright: (c) 2009-2024 Simon Hengel author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net> build-type: Simple@@ -146,7 +146,7 @@ , directory , exceptions , filepath- , ghc >=8.0 && <9.10+ , ghc >=8.0 && <9.12 , ghc-paths >=0.1.0.9 , process , syb >=0.3@@ -175,7 +175,7 @@ , doctest , exceptions , filepath- , ghc >=8.0 && <9.10+ , ghc >=8.0 && <9.12 , ghc-paths >=0.1.0.9 , process , syb >=0.3@@ -246,7 +246,7 @@ , directory , exceptions , filepath- , ghc >=8.0 && <9.10+ , ghc >=8.0 && <9.12 , ghc-paths >=0.1.0.9 , hspec >=2.3.0 , hspec-core >=2.3.0
src/Extract.hs view
@@ -1,11 +1,9 @@ {-# LANGUAGE CPP #-} module Extract (Module(..), extract) where -import Prelude hiding (mod, concat)-import Control.Monad+import Imports hiding (mod, concat) import Control.Exception import Data.List (partition, isSuffixOf)-import Data.Maybe import Control.DeepSeq (deepseq, NFData(rnf)) import Data.Generics@@ -166,7 +164,7 @@ # if __GLASGOW_HASKELL__ >= 902 hsc_env' <- liftIO (initializePlugins hsc_env) setSession hsc_env'- return $ modsum+ return modsum # else dynflags' <- liftIO (initializePlugins hsc_env (GHC.ms_hspp_opts modsum)) return $ modsum { ms_hspp_opts = dynflags' }@@ -182,7 +180,15 @@ extract :: [String] -> IO [Module (Located String)] extract args = do packageDBArgs <- getPackageDBArgs- let args' = args ++ packageDBArgs+ let+ args' = args +++#if __GLASGOW_HASKELL__ >= 810+ -- `ghci` ignores unused packages in certain situation. This ensures+ -- that we don't fail in situations where `ghci` would not.+ "-Wno-unused-packages" :+#endif+ packageDBArgs+ mods <- parse args' let docs = map (fmap (fmap convertDosLineEndings) . extractFromModule) mods @@ -253,7 +259,7 @@ in flip fmap docStrs $ \docStr -> (lookup (getLoc docStr) docStrNames, docStr) where- extractAll z = everything (++) ((mkQ [] ((:[]) . z)))+ extractAll z = everything (++) (mkQ [] ((:[]) . z)) extractDocDocString :: LHsDoc GhcPs -> LHsDocString extractDocDocString = fmap hsDocString
src/Imports.hs view
@@ -2,4 +2,5 @@ import Prelude as Imports import Data.Monoid as Imports+import Data.Maybe as Imports import Control.Monad as Imports
src/Language/Haskell/GhciWrapper.hs view
@@ -16,7 +16,6 @@ import System.Exit import Control.Exception import Data.List (isSuffixOf)-import Data.Maybe data Config = Config { configGhci :: String
src/Parse.hs view
@@ -21,7 +21,6 @@ import Data.Char (isSpace) import Data.List (isPrefixOf, stripPrefix)-import Data.Maybe import Data.String import Extract import Location
src/Property.hs view
@@ -11,7 +11,6 @@ import Imports import Data.List-import Data.Maybe import Data.Foldable import Util
src/Run.hs view
@@ -115,10 +115,7 @@ getAddDistArgs :: IO ([String] -> [String]) getAddDistArgs = do env <- getEnvironment- let dist =- case lookup "HASKELL_DIST_DIR" env of- Nothing -> "dist"- Just x -> x+ let dist = fromMaybe "dist" $ lookup "HASKELL_DIST_DIR" env autogen = dist ++ "/build/autogen/" cabalMacros = autogen ++ "cabal_macros.h" @@ -143,7 +140,7 @@ isSuccess s = sErrors s == 0 && sFailures s == 0 evaluateResult :: Result -> IO ()-evaluateResult r = when (not $ isSuccess r) exitFailure+evaluateResult r = unless (isSuccess r) exitFailure doctestWithResult :: Config -> IO Result doctestWithResult config = do
test/Language/Haskell/GhciWrapperSpec.hs view
@@ -102,7 +102,7 @@ context "with -XOverloadedStrings, -Wall and -Werror" $ do it "does not fail on marker expression (bug fix)" $ withInterpreter $ \ghci -> do- ghci ":set -XOverloadedStrings -Wall -Werror" `shouldReturn` ""+ ghci ":seti -XOverloadedStrings -Wall -Werror" `shouldReturn` "" ghci "putStrLn \"foo\"" `shouldReturn` "foo\n" context "with NoImplicitPrelude" $ do
test/RunSpec.hs view
@@ -126,15 +126,20 @@ it "prints a useful error message" $ do (r, _) <- hCapture [stderr] (E.try action :: IO (Either ExitCode Summary))- stripAnsiColors (removeLoadedPackageEnvironment r) `shouldBe` unlines [- ""+ stripAnsiColors (removeLoadedPackageEnvironment r) `shouldBe` unlines (+#if __GLASGOW_HASKELL__ < 910+ "" :+#endif #if __GLASGOW_HASKELL__ >= 906- , "Foo.hs:6:1: error: [GHC-58481]"+ [ "Foo.hs:6:1: error: [GHC-58481]" #else- , "Foo.hs:6:1: error:"+ [ "Foo.hs:6:1: error:" #endif , " parse error (possibly incorrect indentation or mismatched brackets)"- ]+#if __GLASGOW_HASKELL__ >= 910+ , ""+#endif+ ]) describe "expandDirs" $ do it "expands a directory" $ do