From 75df827903de86a2a0ddb44c5c3a55130e2c0930 Mon Sep 17 00:00:00 2001 From: Nikita Volkov Date: Sat, 21 Nov 2015 09:39:09 +0300 Subject: [PATCH] Drop doctest --- Setup.hs | 42 ------------------------------- doctest/Main.hs | 66 ------------------------------------------------- hasql.cabal | 24 +----------------- 3 files changed, 1 insertion(+), 131 deletions(-) delete mode 100644 Setup.hs delete mode 100644 doctest/Main.hs diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index a800e78..0000000 --- a/Setup.hs +++ /dev/null @@ -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 - diff --git a/doctest/Main.hs b/doctest/Main.hs deleted file mode 100644 index 11e3bd8..0000000 --- a/doctest/Main.hs +++ /dev/null @@ -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 diff --git a/hasql.cabal b/hasql.cabal index 00411f5..840ebf9 100644 --- a/hasql.cabal +++ b/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