Commit 867caaea authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

Switch to custom Setup.hs file for cabal-doctests

doctest doesn't respect the `default-extensions` field from the cabal
file, so we previously had to put every extension at the start of each
and every file so that doctests would compile.

Using the `cabal-doctest` package, we can pass the right options to
`doctest` at build time and move extension declarations to the cabal
parent 6b087239
module Main (main) where
#ifndef MIN_VERSION_cabal_doctest
#define MIN_VERSION_cabal_doctest(x,y,z) 0
#if MIN_VERSION_cabal_doctest(1,0,0)
import Distribution.Extra.Doctest ( defaultMainWithDoctests )
main :: IO ()
main = defaultMainWithDoctests "doctests"
#ifdef MIN_VERSION_Cabal
-- If the macro is defined, we have new cabal-install,
-- but for some reason we don't have cabal-doctest in package-db
-- Probably we are running cabal sdist, when otherwise using new-build
-- workflow
#warning You are configuring this package without cabal-doctest installed. \
The doctests test-suite will not work as a result. \
To fix this, install cabal-doctest before configuring.
import Distribution.Simple
main :: IO ()
main = defaultMain
......@@ -11,8 +11,12 @@ author: Hans-Peter Deifel
-- copyright:
-- category:
build-type: Simple
cabal-version: >=1.10
build-type: Custom
cabal-version: >=1.24
base, Cabal, cabal-doctest >= 1.0.2 && <1.1
hs-source-dirs: src
module Main where
import Test.DocTest
import Build_doctests (flags, pkgs, module_sources)
import Data.Foldable (traverse_)
import Test.DocTest (doctest)
main = doctest ["src/"]
main :: IO ()
main = doctest (flags ++ pkgs ++ module_sources)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment