fix doctests for cabal-install-1.18
This commit is contained in:
parent
07f8b6a28a
commit
0d47f4527b
4 changed files with 28 additions and 2 deletions
|
@ -113,6 +113,8 @@ test-suite doctests
|
||||||
, servant
|
, servant
|
||||||
, doctest
|
, doctest
|
||||||
, filemanip
|
, filemanip
|
||||||
|
, directory
|
||||||
|
, filepath
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: test/Doctests.hs
|
main-is: test/Doctests.hs
|
||||||
buildable: True
|
buildable: True
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
import Data.List (isPrefixOf)
|
||||||
|
import System.Directory
|
||||||
|
import System.FilePath
|
||||||
import System.FilePath.Find
|
import System.FilePath.Find
|
||||||
import Test.DocTest
|
import Test.DocTest
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
files <- find always (extension ==? ".hs") "src"
|
files <- find always (extension ==? ".hs") "src"
|
||||||
|
cabalMacrosFile <- getCabalMacrosFile
|
||||||
doctest $ [ "-isrc"
|
doctest $ [ "-isrc"
|
||||||
, "-optP-include"
|
, "-optP-include"
|
||||||
, "-optPdist/build/autogen/cabal_macros.h"
|
, "-optP" ++ cabalMacrosFile
|
||||||
, "-XOverloadedStrings"
|
, "-XOverloadedStrings"
|
||||||
, "-XFlexibleInstances"
|
, "-XFlexibleInstances"
|
||||||
, "-XMultiParamTypeClasses"
|
, "-XMultiParamTypeClasses"
|
||||||
|
@ -16,3 +20,10 @@ main = do
|
||||||
, "-XTypeOperators"
|
, "-XTypeOperators"
|
||||||
] ++ files
|
] ++ files
|
||||||
|
|
||||||
|
getCabalMacrosFile :: IO FilePath
|
||||||
|
getCabalMacrosFile = do
|
||||||
|
contents <- getDirectoryContents "dist"
|
||||||
|
let rest = "build" </> "autogen" </> "cabal_macros.h"
|
||||||
|
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
|
||||||
|
[x] -> "dist" </> x </> rest
|
||||||
|
[] -> "dist" </> rest
|
||||||
|
|
|
@ -107,6 +107,8 @@ test-suite doctests
|
||||||
, servant
|
, servant
|
||||||
, doctest
|
, doctest
|
||||||
, filemanip
|
, filemanip
|
||||||
|
, directory
|
||||||
|
, filepath
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: test/Doctests.hs
|
main-is: test/Doctests.hs
|
||||||
buildable: True
|
buildable: True
|
||||||
|
|
|
@ -1,16 +1,27 @@
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
import Data.List (isPrefixOf)
|
||||||
|
import System.Directory
|
||||||
|
import System.FilePath
|
||||||
import System.FilePath.Find
|
import System.FilePath.Find
|
||||||
import Test.DocTest
|
import Test.DocTest
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
files <- find always (extension ==? ".hs") "src"
|
files <- find always (extension ==? ".hs") "src"
|
||||||
|
cabalMacrosFile <- getCabalMacrosFile
|
||||||
doctest $ [ "-isrc"
|
doctest $ [ "-isrc"
|
||||||
, "-optP-include"
|
, "-optP-include"
|
||||||
, "-optPdist/build/autogen/cabal_macros.h"
|
, "-optP" ++ cabalMacrosFile
|
||||||
, "-XOverloadedStrings"
|
, "-XOverloadedStrings"
|
||||||
, "-XFlexibleInstances"
|
, "-XFlexibleInstances"
|
||||||
, "-XMultiParamTypeClasses"
|
, "-XMultiParamTypeClasses"
|
||||||
] ++ files
|
] ++ files
|
||||||
|
|
||||||
|
getCabalMacrosFile :: IO FilePath
|
||||||
|
getCabalMacrosFile = do
|
||||||
|
contents <- getDirectoryContents "dist"
|
||||||
|
let rest = "build" </> "autogen" </> "cabal_macros.h"
|
||||||
|
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
|
||||||
|
[x] -> "dist" </> x </> rest
|
||||||
|
[] -> "dist" </> rest
|
||||||
|
|
Loading…
Reference in a new issue