Skip to content

Commit bfdcd7e

Browse files
committed
Specify solver goal order in unit test "indepGoals3"
1 parent 27552af commit bfdcd7e

File tree

1 file changed

+30
-11
lines changed
  • cabal-install/tests/UnitTests/Distribution/Solver/Modular

1 file changed

+30
-11
lines changed

cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ tests = [
135135
, testGroup "Independent goals" [
136136
runTest $ indep $ mkTest db16 "indepGoals1" ["A", "B"] (SolverSuccess [("A", 1), ("B", 1), ("C", 1), ("D", 1), ("D", 2), ("E", 1)])
137137
, runTest $ testIndepGoals2 "indepGoals2"
138-
, runTest $ indep $ mkTest db19 "indepGoals3" ["D", "E", "F"] anySolverFailure -- The target order is important.
138+
, runTest $ testIndepGoals3 "indepGoals3"
139139
, runTest $ testIndepGoals4 "indepGoals4"
140140
, runTest $ indep $ mkTest db23 "indepGoals5" ["X", "Y"] (SolverSuccess [("A", 1), ("A", 2), ("B", 1), ("C", 1), ("C", 2), ("X", 1), ("Y", 1)])
141141
, runTest $ indep $ mkTest db24 "indepGoals6" ["X", "Y"] (SolverSuccess [("A", 1), ("A", 2), ("B", 1), ("B", 2), ("X", 1), ("Y", 1)])
@@ -702,16 +702,35 @@ db18 = [
702702
-- > \ | \ / | /
703703
-- > \| V |/
704704
-- > D F E
705-
db19 :: ExampleDb
706-
db19 = [
707-
Right $ exAv "A" 1 [ExAny "C"]
708-
, Right $ exAv "B" 1 [ExAny "C"]
709-
, Right $ exAv "C" 1 []
710-
, Right $ exAv "C" 2 []
711-
, Right $ exAv "D" 1 [ExAny "A", ExFix "C" 1]
712-
, Right $ exAv "E" 1 [ExAny "B", ExFix "C" 2]
713-
, Right $ exAv "F" 1 [ExAny "A", ExAny "B"]
714-
]
705+
testIndepGoals3 :: String -> SolverTest
706+
testIndepGoals3 name =
707+
goalOrder goals $ indep $
708+
mkTest db name ["D", "E", "F"] anySolverFailure
709+
where
710+
db :: ExampleDb
711+
db = [
712+
Right $ exAv "A" 1 [ExAny "C"]
713+
, Right $ exAv "B" 1 [ExAny "C"]
714+
, Right $ exAv "C" 1 []
715+
, Right $ exAv "C" 2 []
716+
, Right $ exAv "D" 1 [ExAny "A", ExFix "C" 1]
717+
, Right $ exAv "E" 1 [ExAny "B", ExFix "C" 2]
718+
, Right $ exAv "F" 1 [ExAny "A", ExAny "B"]
719+
]
720+
721+
goals :: [ExampleVar]
722+
goals = [
723+
P (Indep 0) "D"
724+
, P (Indep 0) "C"
725+
, P (Indep 0) "A"
726+
, P (Indep 1) "E"
727+
, P (Indep 1) "C"
728+
, P (Indep 1) "B"
729+
, P (Indep 2) "F"
730+
, P (Indep 2) "B"
731+
, P (Indep 2) "C"
732+
, P (Indep 2) "A"
733+
]
715734

716735
-- | This test checks that the solver correctly backjumps when dependencies
717736
-- of linked packages are not linked. It is an example where the conflict set

0 commit comments

Comments
 (0)