packages feed

doctest 0.16.0.1 → 0.16.1

raw patch · 7 files changed

+37/−19 lines, 7 filesdep −with-locationdep ~QuickCheckdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependencies removed: with-location

Dependency ranges changed: QuickCheck, hspec

API changes (from Hackage documentation)

Files

CHANGES view
@@ -1,3 +1,8 @@+Changes in 0.16.1+  - Fix loading plugins in doctests. (#224)+  - Require QuickCheck 2.13.1 or newer.+  - Remove dependency on `with-location`+ Changes in 0.16.0.1   - Bump bounds to allow GHC 8.6. (#210) 
README.markdown view
@@ -54,7 +54,7 @@  (A comment line starting with `>>>` denotes an _expression_. All comment lines following an expression denote the _result_ of that expression.-Result is defined by what an+Result is defined by what a [REPL](http://en.wikipedia.org/wiki/Read-eval-print_loop) (e.g. ghci) prints to `stdout` and `stderr` when evaluating that expression.) @@ -156,7 +156,7 @@ stripped relative to the :}.  Some peculiarities on the ghci side mean that whitespace at the very start is lost.-This breaks the example `broken`, since the the x and y are aligned from ghci's+This breaks the example `broken`, since the x and y aren't aligned from ghci's perspective.  A workaround is to avoid leading space, or add a newline such that the indentation does not matter: @@ -294,7 +294,7 @@  ### Hiding examples from Haddock -You can put examples into [named chunks] [named-chunks], and not refer to them+You can put examples into [named chunks][named-chunks], and not refer to them in the export list.  That way they will not be part of the generated Haddock documentation, but Doctest will still find them. @@ -312,7 +312,7 @@  1. The set of GHC extensions that are active when compiling the module code (excluding the doctest examples). The easiest way to specify these extensions-is through [LANGUAGE pragmas] [language-pragma] in your source files.+is through [LANGUAGE pragmas][language-pragma] in your source files. (Doctest will not look at your cabal file.) 2. The set of GHC extensions that are active when executing the Doctest examples. (These are not influenced by the LANGUAGE pragmas in the file.) The@@ -337,7 +337,7 @@  If you want to omit the information which language extensions are enabled from the Doctest examples you can use the method described in [Hiding examples from-Haddock] (#hiding-examples-from-haddock), e.g.:+Haddock](#hiding-examples-from-haddock), e.g.:  ```haskell -- $
doctest.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: d830267b38357e2e5f17c55764df93c08d2c7b450b12cba13fc0795f21a39202+-- hash: 5ffb546147e627ad778b5c2b0392ec522276ee4b6c8d6574f238224b7494bba4  name:           doctest-version:        0.16.0.1+version:        0.16.1 synopsis:       Test interactive Haskell examples description:    The doctest program checks examples in source code comments.  It is modeled                 after doctest for Python (<http://docs.python.org/library/doctest.html>).@@ -230,7 +230,7 @@       test/integration/with-cbits/foo.c   build-depends:       HUnit-    , QuickCheck >=2.11.3+    , QuickCheck >=2.13.1     , base >=4.5 && <5     , base-compat >=0.7.0     , code-page >=0.1@@ -239,7 +239,7 @@     , filepath     , ghc >=7.0 && <8.7     , ghc-paths >=0.1.0.9-    , hspec >=1.5.1+    , hspec >=2.3.0     , mockery     , process     , setenv@@ -247,5 +247,4 @@     , stringbuilder >=0.4     , syb >=0.3     , transformers-    , with-location   default-language: Haskell2010
src/Extract.hs view
@@ -47,6 +47,10 @@ import           Util (convertDosLineEndings) import           PackageDBs (getPackageDBArgs) +#if __GLASGOW_HASKELL__ >= 806+import           DynamicLoading (initializePlugins)+#endif+ -- | A wrapper around `SomeException`, to allow for a custom `Show` instance. newtype ExtractError = ExtractError SomeException   deriving Typeable@@ -107,7 +111,7 @@   mods' <- if needsTemplateHaskellOrQQ mods then enableCompilation mods else return mods    let sortedMods = flattenSCCs (topSortModuleGraph False mods' Nothing)-  reverse <$> mapM (parseModule >=> typecheckModule >=> loadModule) sortedMods+  reverse <$> mapM (loadModPlugins >=> parseModule >=> typecheckModule >=> loadModule) sortedMods   where     -- copied from Haddock/Interface.hs     enableCompilation :: ModuleGraph -> Ghc ModuleGraph@@ -161,6 +165,16 @@       , stubDir    = Just f       , includePaths = addQuoteInclude (includePaths d) [f]       }++#if __GLASGOW_HASKELL__ >= 806+    -- Since GHC 8.6, plugins are initialized on a per module basis+    loadModPlugins modsum = do+      hsc_env <- getSession+      dynflags' <- liftIO (initializePlugins hsc_env (GHC.ms_hspp_opts modsum))+      return $ modsum { ms_hspp_opts = dynflags' }+#else+    loadModPlugins = return+#endif  -- | Extract all docstrings from given list of files/modules. --
test/ExtractSpec.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-} module ExtractSpec (main, spec) where  import           Test.Hspec import           Test.HUnit-import           Data.WithLocation  import           Panic (GhcException (..)) @@ -13,7 +13,7 @@  import           Orphans () -shouldGive :: WithLocation ((String, String) -> [Module String] -> Assertion)+shouldGive :: HasCallStack => (String, String) -> [Module String] -> Assertion (d, m) `shouldGive` expected = do   r <- map (fmap unLoc) `fmap` extract ["-i" ++ dir, dir </> m]   r `shouldBe` expected
test/MainSpec.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-} module MainSpec (main, spec) where  import           Test.Hspec import           Test.HUnit (assertEqual, Assertion)-import           Data.WithLocation  import           Control.Exception import           System.Directory (getCurrentDirectory, setCurrentDirectory)@@ -21,10 +21,10 @@     action  -- | Construct a doctest specific 'Assertion'.-doctest :: WithLocation (FilePath -> [String] -> Summary -> Assertion)+doctest :: HasCallStack => FilePath -> [String] -> Summary -> Assertion doctest = doctestWithPreserveIt defaultPreserveIt -doctestWithPreserveIt :: WithLocation (Bool -> FilePath -> [String] -> Summary -> Assertion)+doctestWithPreserveIt :: HasCallStack => Bool -> FilePath -> [String] -> Summary -> Assertion doctestWithPreserveIt preserveIt workingDir args expected = do   actual <- withCurrentDirectory ("test/integration" </> workingDir) (hSilence [stderr] $ doctestWithOptions defaultFastMode preserveIt defaultVerbose args)   assertEqual label expected actual
test/PropertySpec.hs view
@@ -18,7 +18,7 @@ spec = do   describe "runProperty" $ do     it "reports a failing property" $ withInterpreter [] $ \repl -> do-      runProperty repl "False" `shouldReturn` Failure "*** Failed! Falsifiable (after 1 test):"+      runProperty repl "False" `shouldReturn` Failure "*** Failed! Falsified (after 1 test):"      it "runs a Bool property" $ withInterpreter [] $ \repl -> do       runProperty repl "True" `shouldReturn` Success@@ -49,7 +49,7 @@       runProperty repl "\\x -> x + y == y + x" `shouldReturn` Success      it "reports the value for which a property fails" $ withInterpreter [] $ \repl -> do-      runProperty repl "x == 23" `shouldReturn` Failure "*** Failed! Falsifiable (after 1 test):\n0"+      runProperty repl "x == 23" `shouldReturn` Failure "*** Failed! Falsified (after 1 test):\n0"      it "reports the values for which a property that takes multiple arguments fails" $ withInterpreter [] $ \repl -> do       let vals x = case x of (Failure r) -> tail (lines r); _ -> error "Property did not fail!"