Skip to content

Commit 4101ecd

Browse files
committed
Add test for ==1 || ==2
1 parent 836a928 commit 4101ecd

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

  • cabal-install/tests/UnitTests/Distribution/Solver/Modular

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ tests =
254254
whenAll = onlyConstrained OnlyConstrainedAll
255255
whenEq = onlyConstrained OnlyConstrainedEq
256256

257-
-- ==1
257+
-- ==1, ==2
258258
eq1 = C.thisVersion $ mkSimpleVersion 1
259+
eq2 = C.thisVersion $ mkSimpleVersion 2
259260

260261
-- >0
261262
gt0 = C.laterVersion $ C.mkVersion [0]
@@ -276,7 +277,7 @@ tests =
276277
-- ==1 && >0
277278
eqGt = C.intersectVersionRanges eq1 gt0
278279

279-
-- ==1 | >0
280+
-- ==1 || >0
280281
eqOrGt = C.unionVersionRanges eq1 gt0
281282

282283
-- >0 && ==1
@@ -285,6 +286,9 @@ tests =
285286
-- >0 || ==1
286287
gtOrEq = C.unionVersionRanges gt0 eq1
287288

289+
-- ==1 || ==2
290+
eqOrEq = C.unionVersionRanges eq1 eq2
291+
288292
-- <=1 && >=1
289293
lege1 = C.intersectVersionRanges le1 ge1
290294

@@ -329,6 +333,12 @@ tests =
329333
, mkConstraint "C" ce1
330334
]
331335

336+
-- B ==1 || ==2, C ==1 || ==2
337+
eqOrEqConstraints =
338+
[ mkConstraint "B" eqOrEq
339+
, mkConstraint "C" eqOrEq
340+
]
341+
332342
-- B <=1 && >=1, C <=1 && >=1
333343
legeConstraints =
334344
[ mkConstraint "B" lege1
@@ -379,6 +389,10 @@ tests =
379389
(mkTest db17 "goal A with B <=1 && >=1, C <=1 && >=1" ["A"] solveABC)
380390
{ testConstraints = legeConstraints
381391
}
392+
, runTest . whenAll $
393+
(mkTest db17 "goal A with B ==1 || ==2, C ==1 || ==2" ["A"] solveABC)
394+
{ testConstraints = eqOrEqConstraints
395+
}
382396
, runTest . whenAll $
383397
(mkTest db17 "goal A with B >0 && ==1 && <2, C >0 && ==1 && <2" ["A"] solveABC)
384398
{ testConstraints = gtEqLtConstraints
@@ -461,6 +475,10 @@ tests =
461475
(mkTest db17 "goal A with B ^>=1, C ^>=1" ["A"] eqFailure)
462476
{ testConstraints = celeConstraints
463477
}
478+
, runTest . whenEq $
479+
(mkTest db17 "goal A with B ==1 || ==2, C ==1 || ==2" ["A"] eqFailure)
480+
{ testConstraints = eqOrEqConstraints
481+
}
464482
, runTest . whenEq $
465483
(mkTest db17 "goal A with B <=1 && >=1, C <=1 && >=1" ["A"] eqFailure)
466484
{ testConstraints = legeConstraints

0 commit comments

Comments
 (0)