Skip to content

Commit 0cb52ac

Browse files
authored
Merge pull request #93 from haskell-works/enable-doctest
Enable doctest
2 parents b47b7dc + 482e84d commit 0cb52ac

File tree

2 files changed

+51
-24
lines changed

2 files changed

+51
-24
lines changed

doctest/DoctestDriver.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
#if MIN_VERSION_GLASGOW_HASKELL(8,4,4,0)
4+
{-# OPTIONS_GHC -F -pgmF doctest-discover #-}
5+
#else
6+
module Main where
7+
8+
import qualified System.IO as IO
9+
10+
main :: IO ()
11+
main = IO.putStrLn "WARNING: doctest will not run on GHC versions earlier than 8.4.4"
12+
#endif

hw-prim.cabal

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,37 @@ flag bounds-checking-enabled
2626
manual: False
2727
default: False
2828

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

31-
common QuickCheck { build-depends: QuickCheck >= 2.10 && < 2.14 }
32-
common bytestring { build-depends: bytestring >= 0.9 && < 0.11 }
33-
common criterion { build-depends: criterion >= 1.2 && < 1.6 }
34-
common deepseq { build-depends: deepseq >= 1.4 && < 1.5 }
35-
common directory { build-depends: directory >= 1.2 && < 1.4 }
36-
common exceptions { build-depends: exceptions >= 0.8 && < 0.11 }
37-
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.6 }
38-
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.1 }
39-
common hspec { build-depends: hspec >= 2.4 && < 2.8 }
40-
common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1 && < 0.2 }
41-
common mmap { build-depends: mmap >= 0.5 && < 0.6 }
42-
common semigroups { build-depends: semigroups >= 0.8.4 && < 0.20 }
43-
common transformers { build-depends: transformers >= 0.4 && < 0.6 }
44-
common vector { build-depends: vector >= 0.12 && < 0.13 }
45-
common unliftio-core { build-depends: unliftio-core >= 0.1.2.0 && < 0.2 }
31+
common QuickCheck { build-depends: QuickCheck >= 2.10 && < 2.14 }
32+
common bytestring { build-depends: bytestring >= 0.9 && < 0.11 }
33+
common criterion { build-depends: criterion >= 1.2 && < 1.6 }
34+
common deepseq { build-depends: deepseq >= 1.4 && < 1.5 }
35+
common directory { build-depends: directory >= 1.2 && < 1.4 }
36+
common doctest { build-depends: doctest >= 0.16.2 && < 0.17 }
37+
common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 }
38+
common exceptions { build-depends: exceptions >= 0.8 && < 0.11 }
39+
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.6 }
40+
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.1 }
41+
common hspec { build-depends: hspec >= 2.4 && < 2.8 }
42+
common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1 && < 0.2 }
43+
common mmap { build-depends: mmap >= 0.5 && < 0.6 }
44+
common semigroups { build-depends: semigroups >= 0.8.4 && < 0.20 }
45+
common transformers { build-depends: transformers >= 0.4 && < 0.6 }
46+
common vector { build-depends: vector >= 0.12 && < 0.13 }
47+
common unliftio-core { build-depends: unliftio-core >= 0.1.2.0 && < 0.2 }
4648

47-
common common
49+
common hw-prim
50+
build-depends: hw-prim
51+
52+
common config
4853
default-language: Haskell2010
4954
ghc-options: -Wall -O2 -msse4.2
5055
if flag(bounds-checking-enabled)
5156
cpp-options: -DBOUNDS_CHECKING_ENABLED
5257

5358
library
54-
import: base
55-
, common
59+
import: base, config
5660
, bytestring
5761
, deepseq
5862
, ghc-prim
@@ -112,15 +116,15 @@ library
112116
hs-source-dirs: src
113117

114118
test-suite hw-prim-test
115-
import: base
116-
, common
119+
import: base, config
117120
, QuickCheck
118121
, bytestring
119122
, directory
120123
, exceptions
121124
, hedgehog
122125
, hspec
123126
, hw-hspec-hedgehog
127+
, hw-prim
124128
, mmap
125129
, semigroups
126130
, transformers
@@ -139,16 +143,15 @@ test-suite hw-prim-test
139143
HaskellWorks.Data.Vector.StorableSpec
140144
Paths_hw_prim
141145
autogen-modules: Paths_hw_prim
142-
build-depends: hw-prim
143146
hs-source-dirs: test
144147
ghc-options: -threaded -rtsopts -with-rtsopts=-N
145148
build-tool-depends: hspec-discover:hspec-discover
146149

147150
benchmark bench
148-
import: base
149-
, common
151+
import: base, config
150152
, bytestring
151153
, criterion
154+
, hw-prim
152155
, mmap
153156
, semigroups
154157
, transformers
@@ -159,3 +162,15 @@ benchmark bench
159162
hs-source-dirs: bench
160163
build-depends: hw-prim
161164
autogen-modules: Paths_hw_prim
165+
166+
test-suite doctest
167+
import: base, config
168+
, doctest
169+
, doctest-discover
170+
, hw-prim
171+
default-language: Haskell2010
172+
type: exitcode-stdio-1.0
173+
ghc-options: -threaded
174+
main-is: DoctestDriver.hs
175+
HS-Source-Dirs: doctest
176+
build-tool-depends: doctest-discover:doctest-discover

0 commit comments

Comments
 (0)