Skip to content

Enable doctest #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doctest/DoctestDriver.hs
Original file line number Diff line number Diff line change
@@ -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
63 changes: 39 additions & 24 deletions hw-prim.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,37 @@ flag bounds-checking-enabled
manual: False
default: False

common base { build-depends: base >= 4 && < 5 }
common base { build-depends: base >= 4 && < 5 }

common QuickCheck { build-depends: QuickCheck >= 2.10 && < 2.14 }
common bytestring { build-depends: bytestring >= 0.9 && < 0.11 }
common criterion { build-depends: criterion >= 1.2 && < 1.6 }
common deepseq { build-depends: deepseq >= 1.4 && < 1.5 }
common directory { build-depends: directory >= 1.2 && < 1.4 }
common exceptions { build-depends: exceptions >= 0.8 && < 0.11 }
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.6 }
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.1 }
common hspec { build-depends: hspec >= 2.4 && < 2.8 }
common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1 && < 0.2 }
common mmap { build-depends: mmap >= 0.5 && < 0.6 }
common semigroups { build-depends: semigroups >= 0.8.4 && < 0.20 }
common transformers { build-depends: transformers >= 0.4 && < 0.6 }
common vector { build-depends: vector >= 0.12 && < 0.13 }
common unliftio-core { build-depends: unliftio-core >= 0.1.2.0 && < 0.2 }
common QuickCheck { build-depends: QuickCheck >= 2.10 && < 2.14 }
common bytestring { build-depends: bytestring >= 0.9 && < 0.11 }
common criterion { build-depends: criterion >= 1.2 && < 1.6 }
common deepseq { build-depends: deepseq >= 1.4 && < 1.5 }
common directory { build-depends: directory >= 1.2 && < 1.4 }
common doctest { build-depends: doctest >= 0.16.2 && < 0.17 }
common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 }
common exceptions { build-depends: exceptions >= 0.8 && < 0.11 }
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.6 }
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.1 }
common hspec { build-depends: hspec >= 2.4 && < 2.8 }
common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1 && < 0.2 }
common mmap { build-depends: mmap >= 0.5 && < 0.6 }
common semigroups { build-depends: semigroups >= 0.8.4 && < 0.20 }
common transformers { build-depends: transformers >= 0.4 && < 0.6 }
common vector { build-depends: vector >= 0.12 && < 0.13 }
common unliftio-core { build-depends: unliftio-core >= 0.1.2.0 && < 0.2 }

common common
common hw-prim
build-depends: hw-prim

common config
default-language: Haskell2010
ghc-options: -Wall -O2 -msse4.2
if flag(bounds-checking-enabled)
cpp-options: -DBOUNDS_CHECKING_ENABLED

library
import: base
, common
import: base, config
, bytestring
, deepseq
, ghc-prim
Expand Down Expand Up @@ -112,15 +116,15 @@ library
hs-source-dirs: src

test-suite hw-prim-test
import: base
, common
import: base, config
, QuickCheck
, bytestring
, directory
, exceptions
, hedgehog
, hspec
, hw-hspec-hedgehog
, hw-prim
, mmap
, semigroups
, transformers
Expand All @@ -139,16 +143,15 @@ test-suite hw-prim-test
HaskellWorks.Data.Vector.StorableSpec
Paths_hw_prim
autogen-modules: Paths_hw_prim
build-depends: hw-prim
hs-source-dirs: test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-tool-depends: hspec-discover:hspec-discover

benchmark bench
import: base
, common
import: base, config
, bytestring
, criterion
, hw-prim
, mmap
, semigroups
, transformers
Expand All @@ -159,3 +162,15 @@ benchmark bench
hs-source-dirs: bench
build-depends: hw-prim
autogen-modules: Paths_hw_prim

test-suite doctest
import: base, config
, doctest
, doctest-discover
, hw-prim
default-language: Haskell2010
type: exitcode-stdio-1.0
ghc-options: -threaded
main-is: DoctestDriver.hs
HS-Source-Dirs: doctest
build-tool-depends: doctest-discover:doctest-discover