mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-27 12:35:50 +03:00
Drop doctest
This commit is contained in:
parent
d46f657dd9
commit
75df827903
42
Setup.hs
42
Setup.hs
@ -1,42 +0,0 @@
|
||||
-- The code is mostly ripped from
|
||||
-- https://github.com/ekmett/lens/blob/697582fb9a980f273dbf8496253c5bbefedd0a8b/Setup.lhs
|
||||
import Data.List (nub)
|
||||
import Data.Version (showVersion)
|
||||
import Distribution.Package (PackageName(PackageName), Package, PackageId, InstalledPackageId, packageVersion, packageName)
|
||||
import Distribution.PackageDescription (PackageDescription(), TestSuite(..))
|
||||
import Distribution.Simple (defaultMainWithHooks, UserHooks(..), simpleUserHooks)
|
||||
import Distribution.Simple.Utils (rewriteFile, createDirectoryIfMissingVerbose, copyFiles)
|
||||
import Distribution.Simple.BuildPaths (autogenModulesDir)
|
||||
import Distribution.Simple.Setup (BuildFlags(buildVerbosity), Flag(..), fromFlag, HaddockFlags(haddockDistPref))
|
||||
import Distribution.Simple.LocalBuildInfo (withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps))
|
||||
import Distribution.Text (display)
|
||||
import Distribution.Verbosity (Verbosity, normal)
|
||||
import System.FilePath ((</>))
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMainWithHooks simpleUserHooks
|
||||
{ buildHook = \pkg lbi hooks flags -> do
|
||||
generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi
|
||||
buildHook simpleUserHooks pkg lbi hooks flags
|
||||
}
|
||||
|
||||
generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
|
||||
generateBuildModule verbosity pkg lbi = do
|
||||
let dir = autogenModulesDir lbi
|
||||
createDirectoryIfMissingVerbose verbosity True dir
|
||||
withLibLBI pkg lbi $ \_ libcfg -> do
|
||||
withTestLBI pkg lbi $ \suite suitecfg -> do
|
||||
rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
|
||||
[ "module Build_" ++ testName suite ++ " where"
|
||||
, "import Prelude"
|
||||
, "deps :: [String]"
|
||||
, "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
|
||||
]
|
||||
where
|
||||
formatdeps = map (formatone . snd)
|
||||
formatone p = case packageName p of
|
||||
PackageName n -> n ++ "-" ++ showVersion (packageVersion p)
|
||||
|
||||
testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
|
||||
testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys
|
||||
|
@ -1,66 +0,0 @@
|
||||
-- The code is mostly ripped from
|
||||
-- https://github.com/ekmett/lens/blob/d1d97469f0e93c1d3535308954a060e8a04e37aa/tests/doctests.hsc
|
||||
import BasePrelude
|
||||
import System.Directory
|
||||
import System.FilePath
|
||||
import Test.DocTest
|
||||
import Build_doctest (deps)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
sources <- getSources
|
||||
doctest $ dfltParams ++ map ("-package="++) deps ++ sources
|
||||
where
|
||||
dfltParams =
|
||||
[
|
||||
"-isrc",
|
||||
"-idist/build/autogen",
|
||||
"-optP-include",
|
||||
"-optPdist/build/autogen/cabal_macros.h",
|
||||
"-XArrows",
|
||||
"-XBangPatterns",
|
||||
"-XConstraintKinds",
|
||||
"-XDataKinds",
|
||||
"-XDefaultSignatures",
|
||||
"-XDeriveDataTypeable",
|
||||
"-XDeriveFunctor",
|
||||
"-XDeriveGeneric",
|
||||
"-XEmptyDataDecls",
|
||||
"-XFlexibleContexts",
|
||||
"-XFlexibleInstances",
|
||||
"-XFunctionalDependencies",
|
||||
"-XGADTs",
|
||||
"-XGeneralizedNewtypeDeriving",
|
||||
"-XImpredicativeTypes",
|
||||
"-XLambdaCase",
|
||||
"-XLiberalTypeSynonyms",
|
||||
"-XMultiParamTypeClasses",
|
||||
"-XMultiWayIf",
|
||||
"-XNoImplicitPrelude",
|
||||
"-XNoMonomorphismRestriction",
|
||||
"-XOverloadedStrings",
|
||||
"-XPatternGuards",
|
||||
"-XParallelListComp",
|
||||
"-XQuasiQuotes",
|
||||
"-XRankNTypes",
|
||||
"-XRecordWildCards",
|
||||
"-XScopedTypeVariables",
|
||||
"-XStandaloneDeriving",
|
||||
"-XTemplateHaskell",
|
||||
"-XTupleSections",
|
||||
"-XTypeFamilies",
|
||||
"-XTypeOperators",
|
||||
"-hide-all-packages"
|
||||
]
|
||||
|
||||
getSources :: IO [FilePath]
|
||||
getSources = filter (isSuffixOf ".hs") <$> go "library"
|
||||
where
|
||||
go dir = do
|
||||
(dirs, files) <- getFilesAndDirectories dir
|
||||
(files ++) . concat <$> mapM go dirs
|
||||
|
||||
getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])
|
||||
getFilesAndDirectories dir = do
|
||||
c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir
|
||||
(,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c
|
24
hasql.cabal
24
hasql.cabal
@ -23,7 +23,7 @@ license:
|
||||
license-file:
|
||||
LICENSE
|
||||
build-type:
|
||||
Custom
|
||||
Simple
|
||||
cabal-version:
|
||||
>=1.10
|
||||
|
||||
@ -95,28 +95,6 @@ library
|
||||
base >= 4.6 && < 5
|
||||
|
||||
|
||||
test-suite doctest
|
||||
type:
|
||||
exitcode-stdio-1.0
|
||||
hs-source-dirs:
|
||||
doctest
|
||||
main-is:
|
||||
Main.hs
|
||||
ghc-options:
|
||||
-threaded
|
||||
"-with-rtsopts=-N"
|
||||
build-depends:
|
||||
doctest == 0.10.*,
|
||||
directory == 1.2.*,
|
||||
filepath >= 1.3 && < 1.5,
|
||||
base-prelude >= 0.1.19 && < 0.2,
|
||||
base
|
||||
default-extensions:
|
||||
Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
|
||||
default-language:
|
||||
Haskell2010
|
||||
|
||||
|
||||
-- Note that this test-suite is supposed to be single-threaded.
|
||||
-- Hence the absense of the appropriate GHC flags.
|
||||
test-suite tasty
|
||||
|
Loading…
Reference in New Issue
Block a user