From 764859f96e8529bd2210901389b305d762933a07 Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 10 Dec 2019 15:01:52 +1100 Subject: [PATCH] Enable doctest --- doctest/DoctestDriver.hs | 12 +++++++ hw-diagnostics.cabal | 72 +++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 27 deletions(-) create mode 100644 doctest/DoctestDriver.hs diff --git a/doctest/DoctestDriver.hs b/doctest/DoctestDriver.hs new file mode 100644 index 0000000..a1f4f4b --- /dev/null +++ b/doctest/DoctestDriver.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE CPP #-} + +#if MIN_VERSION_GLASGOW_HASKELL(8,4,4,0) +{-# OPTIONS_GHC -F -pgmF doctest-discover #-} +#else +module Main where + +import qualified System.IO as IO + +main :: IO () +main = IO.putStrLn "WARNING: doctest will not run on GHC versions earlier than 8.4.4" +#endif diff --git a/hw-diagnostics.cabal b/hw-diagnostics.cabal index 5f3c1d1..e2b4ee7 100644 --- a/hw-diagnostics.cabal +++ b/hw-diagnostics.cabal @@ -1,33 +1,51 @@ -name: hw-diagnostics -version: 0.0.0.7 -synopsis: Diagnostics library -description: Please see README.md -category: Profiling -homepage: http://github.com/haskell-works/hw-diagnostics#readme -bug-reports: https://github.com/haskell-works/hw-diagnostics/issues -author: John Ky -maintainer: newhoggy@gmail.com -copyright: 2016 John Ky -license: BSD3 -license-file: LICENSE -build-type: Simple -cabal-version: >= 1.10 -extra-source-files: - README.md +cabal-version: 2.4 + +name: hw-diagnostics +version: 0.0.0.7 +synopsis: Diagnostics library +description: Please see README.md +category: Profiling +homepage: http://github.com/haskell-works/hw-diagnostics#readme +bug-reports: https://github.com/haskell-works/hw-diagnostics/issues +author: John Ky +maintainer: newhoggy@gmail.com +copyright: 2016-2019 John Ky +license: BSD-3-Clause +license-file: LICENSE +build-type: Simple +extra-source-files: README.md source-repository head type: git location: https://github.com/haskell-works/hw-diagnostics +common base { build-depends: base >= 4 && < 5 } + +common doctest { build-depends: doctest >= 0.16.2 && < 0.17 } +common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 } + +common hw-diagnostics + build-depends: hw-diagnostics + +common config + ghc-options: -Wall + default-language: Haskell2010 + library - exposed-modules: - HaskellWorks.Diagnostics - HaskellWorks.Diagnostics.Time - other-modules: - Paths_hw_diagnostics - hs-source-dirs: - src - ghc-options: -Wall - build-depends: - base >=4 && <5 - default-language: Haskell2010 + import: base, config + exposed-modules: HaskellWorks.Diagnostics + HaskellWorks.Diagnostics.Time + other-modules: Paths_hw_diagnostics + autogen-modules: Paths_hw_diagnostics + hs-source-dirs: src + +test-suite doctest + import: base, config + , doctest + , doctest-discover + , hw-diagnostics + type: exitcode-stdio-1.0 + ghc-options: -threaded + main-is: DoctestDriver.hs + HS-Source-Dirs: doctest + build-tool-depends: doctest-discover:doctest-discover