From 00551732801996757ba98da0e0d117f57824920a Mon Sep 17 00:00:00 2001 From: Kristen Kozak Date: Sat, 22 Oct 2016 19:55:08 -0700 Subject: [PATCH] Fix solver-quickcheck failure. --- .../Distribution/Solver/Modular/QuickCheck.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs index b9387f6e303..2d490a3699e 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs @@ -258,11 +258,13 @@ arbitraryExDep db@(TestDb pkgs) level = let flag = ExFlag <$> arbitraryFlagName <*> arbitraryDeps db <*> arbitraryDeps db - other = [ - ExAny . unPN <$> elements (map getName pkgs) - + other = + -- Package checks require dependencies on "base" to have bounds. + let notBase = filter ((/= PN "base") . getName) pkgs + in [ExAny . unPN <$> elements (map getName notBase) | not (null notBase)] + ++ [ -- existing version - , let fixed pkg = ExFix (unPN $ getName pkg) (unPV $ getVersion pkg) + let fixed pkg = ExFix (unPN $ getName pkg) (unPV $ getVersion pkg) in fixed <$> elements pkgs -- random version of an existing package @@ -332,6 +334,7 @@ instance Arbitrary ExampleDependency where arbitrary = error "arbitrary not implemented: ExampleDependency" shrink (ExAny _) = [] + shrink p@(ExFix "base" _) = [p] -- preserve bounds on base shrink (ExFix pn _) = [ExAny pn] shrink (ExFlag flag th el) = deps th ++ deps el