Skip to content

Commit f3fb529

Browse files
authored
Merge pull request #9 from haskell-works/enable-doctest
Enable doctest
2 parents 21a00e7 + ea9e206 commit f3fb529

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
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-json-simple-cursor.cabal

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ common base { build-depends: base >= 4
4242
common bytestring { build-depends: bytestring >= 0.10.6 && < 0.11 }
4343
common criterion { build-depends: criterion >= 1.4 && < 1.6 }
4444
common directory { build-depends: directory >= 1.3 && < 1.4 }
45+
common doctest { build-depends: doctest >= 0.16.2 && < 0.17 }
46+
common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 }
4547
common generic-lens { build-depends: generic-lens >= 1.1.0.0 && < 1.3 }
4648
common hedgehog { build-depends: hedgehog >= 0.6 && < 1.1 }
4749
common hspec { build-depends: hspec >= 2.4 && < 3 }
@@ -63,6 +65,9 @@ common word8 { build-depends: word8 >= 0.1
6365

6466
common semigroups { if impl(ghc < 8 ) { build-depends: semigroups >= 0.16 && < 0.19 } }
6567

68+
common hw-json-simple-cursor
69+
build-depends: hw-json-simple-cursor
70+
6671
common config
6772
default-language: Haskell2010
6873
ghc-options: -Wall -O2 -msse4.2
@@ -99,6 +104,7 @@ executable hw-json
99104
, generic-lens
100105
, hw-balancedparens
101106
, hw-json-simd
107+
, hw-json-simple-cursor
102108
, hw-prim
103109
, hw-rankselect
104110
, hw-rankselect-base
@@ -111,7 +117,6 @@ executable hw-json
111117
main-is: Main.hs
112118
hs-source-dirs: app
113119
ghc-options: -threaded -rtsopts -with-rtsopts=-N
114-
build-depends: hw-json-simple-cursor
115120
other-modules: App.Commands
116121
App.Commands.CreateIndex
117122
App.Commands.Types
@@ -124,13 +129,13 @@ test-suite hw-json-test
124129
, hw-balancedparens
125130
, hw-bits
126131
, hw-hspec-hedgehog
132+
, hw-json-simple-cursor
127133
, hw-prim
128134
, hw-rankselect
129135
, hw-rankselect-base
130136
, vector
131137
type: exitcode-stdio-1.0
132138
main-is: Spec.hs
133-
build-depends: hw-json-simple-cursor
134139
hs-source-dirs: test
135140
ghc-options: -threaded -rtsopts -with-rtsopts=-N
136141
build-tool-depends: hspec-discover:hspec-discover
@@ -142,10 +147,22 @@ benchmark bench
142147
, bytestring
143148
, criterion
144149
, directory
150+
, hw-json-simple-cursor
145151
, mmap
146152
, semigroups
147153
type: exitcode-stdio-1.0
148154
main-is: Main.hs
149155
hs-source-dirs: bench
150-
build-depends: hw-json-simple-cursor
151156
other-modules: Paths_hw_json_simple_cursor
157+
158+
test-suite doctest
159+
import: base, config
160+
, doctest
161+
, doctest-discover
162+
, hw-json-simple-cursor
163+
default-language: Haskell2010
164+
type: exitcode-stdio-1.0
165+
ghc-options: -threaded
166+
main-is: DoctestDriver.hs
167+
HS-Source-Dirs: doctest
168+
build-tool-depends: doctest-discover:doctest-discover

0 commit comments

Comments
 (0)