aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-12-15 23:18:41 +0100
committerDaniel Gröber <dxld@darkboxed.org>2019-01-22 03:06:51 +0100
commit0d2011d04fd06fc6bb21407d2f412439668b6249 (patch)
tree30a959965aa8573762836a6dc29c9521f12c2fe7 /tests
parent66ff20ada55558ab1fda09f22f4f6f6de0736136 (diff)
Sync with Cabal HEAD
Diffstat (limited to 'tests')
-rw-r--r--tests/CompileTest.hs14
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs
index b5d9003..3be4dc2 100644
--- a/tests/CompileTest.hs
+++ b/tests/CompileTest.hs
@@ -17,15 +17,14 @@ import Data.Maybe
import Data.Version
import Data.Functor
import Data.Function
-import qualified Distribution.Compat.ReadP as Dist
import Distribution.Version (VersionRange, withinRange)
-import Distribution.Text
import Control.Arrow
import Control.Monad
import Prelude
import CabalHelper.Compiletime.Compat.Environment
import CabalHelper.Compiletime.Compat.Version
+import CabalHelper.Compiletime.Compat.Parsec
import CabalHelper.Compiletime.Cabal
import CabalHelper.Compiletime.Compile
import CabalHelper.Compiletime.Program.CabalInstall
@@ -33,11 +32,6 @@ import CabalHelper.Compiletime.Program.GHC
import CabalHelper.Compiletime.Types
import CabalHelper.Shared.Common
-runReadP'Dist :: Dist.ReadP t t -> String -> t
-runReadP'Dist p i = case filter ((=="") . snd) $ Dist.readP_to_S p i of
- (a,""):[] -> a
- _ -> error $ "Error parsing: " ++ show i
-
withinRange'CH :: Version -> VersionRange -> Bool
withinRange'CH v r =
withinRange (fromDataVersion v) r
@@ -123,14 +117,14 @@ allCabalVersions ghc_ver = let
]
constraint :: VersionRange
- constraint =
- fromMaybe (snd $ last constraint_table) $
+ Just constraint =
fmap snd $
find (and . (zipWith (==) `on` versionBranch) ghc_ver . fst) $
constraint_table
+ constraint_table :: [(Version, VersionRange)]
constraint_table =
- map (parseVer *** runReadP'Dist parse) $
+ map (parseVer *** (absorbParsecFailure "constraint_table" . eitherParsec)) $
-- , ("7.8" , ">= 1.18 && < 2")
[ ("7.10" , ">= 1.22.2 && < 2")
, ("8.0.1", ">= 1.24 ")