[commit: haddock] 2.15, 2.15.0.1, 2.15.0.2, T6018-injective-type-families, adamse-D1033, clean, fix-travis, ghc-head, master, metainfo, v2.15, wip/10268, wip/10313, wip/D538, wip/D538-1, wip/D538-2, wip/D538-3, wip/D538-4, wip/D538-5, wip/D538-6, wip/D548-master, wip/D548-master-2, wip/T10483, wip/T8584, wip/T9840, wip/api-ann-hstylit, wip/api-ann-hstylit-1, wip/api-ann-hstylit-2, wip/api-ann-hstylit-3, wip/api-ann-hstylit-4, wip/api-ann-hstylit-5, wip/api-annot-tweaks-7.10, wip/api-annots-ghc-7.10-3, wip/ast-annotations-separate, wip/ast-prepare-annotations, wip/ast-prepare-annotations-final, wip/ast-prepare-annotations-final2, wip/ast-prepare-annotations-final3, wip/ast-prepare-annotations-final4, wip/ast-prepare-annotations-final5, wip/ast-prepare-annotations-final6, wip/attoparsec-update, wip/landmine-param-family, wip/orf-new, wip/orf-reboot, wip/pattern-synonyms, wip/rae, wip/remove-cabal-dep, wip/trac-9744: Use doctest to check examples in documentation (1bbda54)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:28:39 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.15,2.15.0.1,2.15.0.2,T6018-injective-type-families,adamse-D1033,clean,fix-travis,ghc-head,master,metainfo,v2.15,wip/10268,wip/10313,wip/D538,wip/D538-1,wip/D538-2,wip/D538-3,wip/D538-4,wip/D538-5,wip/D538-6,wip/D548-master,wip/D548-master-2,wip/T10483,wip/T8584,wip/T9840,wip/api-ann-hstylit,wip/api-ann-hstylit-1,wip/api-ann-hstylit-2,wip/api-ann-hstylit-3,wip/api-ann-hstylit-4,wip/api-ann-hstylit-5,wip/api-annot-tweaks-7.10,wip/api-annots-ghc-7.10-3,wip/ast-annotations-separate,wip/ast-prepare-annotations,wip/ast-prepare-annotations-final,wip/ast-prepare-annotations-final2,wip/ast-prepare-annotations-final3,wip/ast-prepare-annotations-final4,wip/ast-prepare-annotations-final5,wip/ast-prepare-annotations-final6,wip/attoparsec-update,wip/landmine-param-family,wip/orf-new,wip/orf-reboot,wip/pattern-synonyms,wip/rae,wip/remove-cabal-dep,wip/trac-9744
Link       : http://git.haskell.org/haddock.git/commitdiff/1bbda54a9cf1c8db93c5ef226c2a94ed38a842ff

>---------------------------------------------------------------

commit 1bbda54a9cf1c8db93c5ef226c2a94ed38a842ff
Author: Simon Hengel <sol at typeful.net>
Date:   Wed Jun 18 13:50:34 2014 +0800

    Use doctest to check examples in documentation


>---------------------------------------------------------------

1bbda54a9cf1c8db93c5ef226c2a94ed38a842ff
 haddock-library/haddock-library.cabal               |  8 ++++++++
 haddock-library/src/Documentation/Haddock/Parser.hs |  3 +++
 haddock-library/test/doctests.hs                    | 11 +++++++++++
 3 files changed, 22 insertions(+)

diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal
index 20e0e94..8af94a4 100644
--- a/haddock-library/haddock-library.cabal
+++ b/haddock-library/haddock-library.cabal
@@ -73,6 +73,14 @@ test-suite spec
     , deepseq
     , QuickCheck == 2.*
 
+test-suite doctests
+  type:             exitcode-stdio-1.0
+  default-language: Haskell2010
+  hs-source-dirs:   test
+  main-is:          doctests.hs
+  ghc-options:      -threaded
+  build-depends:    base, doctest >= 0.8
+
 source-repository head
   type:     git
   subdir:   haddock-library
diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs
index b717884..c84217b 100644
--- a/haddock-library/src/Documentation/Haddock/Parser.hs
+++ b/haddock-library/src/Documentation/Haddock/Parser.hs
@@ -38,6 +38,9 @@ import           Documentation.Haddock.Types
 import           Documentation.Haddock.Utf8
 import           Prelude hiding (takeWhile)
 
+-- $setup
+-- >>> :set -XOverloadedStrings
+
 -- | Identifier string surrounded with opening and closing quotes/backticks.
 type Identifier = (Char, String, Char)
 
diff --git a/haddock-library/test/doctests.hs b/haddock-library/test/doctests.hs
new file mode 100644
index 0000000..e4f9385
--- /dev/null
+++ b/haddock-library/test/doctests.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import           Test.DocTest
+
+main :: IO ()
+main = doctest [
+    "-isrc"
+  , "-ivendor/attoparsec-0.10.4.0"
+  , "-optP-include", "-optPdist/build/autogen/cabal_macros.h"
+  , "src/Documentation/Haddock/Parser.hs"
+  ]



More information about the ghc-commits mailing list