Skip to content

Commit bab0ed1

Browse files
grayjayezyang
authored andcommitted
Test that setup dependencies of linked packages are not required to be linked
1 parent 86fa55c commit bab0ed1

File tree

1 file changed

+26
-8
lines changed
  • cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular

1 file changed

+26
-8
lines changed

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

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ tests = [
5656
, runTest $ indep $ mkTest db6 "depsWithTests2" ["C", "D"] (Just [("A", 1), ("B", 1), ("C", 1), ("D", 1)])
5757
]
5858
, testGroup "Setup dependencies" [
59-
runTest $ mkTest db7 "setupDeps1" ["B"] (Just [("A", 2), ("B", 1)])
60-
, runTest $ mkTest db7 "setupDeps2" ["C"] (Just [("A", 2), ("C", 1)])
61-
, runTest $ mkTest db7 "setupDeps3" ["D"] (Just [("A", 1), ("D", 1)])
62-
, runTest $ mkTest db7 "setupDeps4" ["E"] (Just [("A", 1), ("A", 2), ("E", 1)])
63-
, runTest $ mkTest db7 "setupDeps5" ["F"] (Just [("A", 1), ("A", 2), ("F", 1)])
64-
, runTest $ mkTest db8 "setupDeps6" ["C", "D"] (Just [("A", 1), ("B", 1), ("B", 2), ("C", 1), ("D", 1)])
65-
, runTest $ mkTest db9 "setupDeps7" ["F", "G"] (Just [("A", 1), ("B", 1), ("B",2 ), ("C", 1), ("D", 1), ("E", 1), ("E", 2), ("F", 1), ("G", 1)])
66-
, runTest $ mkTest db10 "setupDeps8" ["C"] (Just [("C", 1)])
59+
runTest $ mkTest db7 "setupDeps1" ["B"] (Just [("A", 2), ("B", 1)])
60+
, runTest $ mkTest db7 "setupDeps2" ["C"] (Just [("A", 2), ("C", 1)])
61+
, runTest $ mkTest db7 "setupDeps3" ["D"] (Just [("A", 1), ("D", 1)])
62+
, runTest $ mkTest db7 "setupDeps4" ["E"] (Just [("A", 1), ("A", 2), ("E", 1)])
63+
, runTest $ mkTest db7 "setupDeps5" ["F"] (Just [("A", 1), ("A", 2), ("F", 1)])
64+
, runTest $ mkTest db8 "setupDeps6" ["C", "D"] (Just [("A", 1), ("B", 1), ("B", 2), ("C", 1), ("D", 1)])
65+
, runTest $ mkTest db9 "setupDeps7" ["F", "G"] (Just [("A", 1), ("B", 1), ("B",2 ), ("C", 1), ("D", 1), ("E", 1), ("E", 2), ("F", 1), ("G", 1)])
66+
, runTest $ mkTest db10 "setupDeps8" ["C"] (Just [("C", 1)])
67+
, runTest $ indep $ mkTest dbSetupDeps "setupDeps9" ["A", "B"] (Just [("A", 1), ("B", 1), ("C", 1), ("D", 1), ("D", 2)])
6768
]
6869
, testGroup "Base shim" [
6970
runTest $ mkTest db11 "baseShim1" ["A"] (Just [("A", 1)])
@@ -397,6 +398,23 @@ db10 =
397398
, Right $ exAv "C" 1 [ExFix "A" 2] `withSetupDeps` [ExFix "A" 1]
398399
]
399400

401+
-- | This database tests that linking a package does not also link the package's
402+
-- setup dependencies.
403+
--
404+
-- When A and B are installed as independent goals, their dependencies on C must
405+
-- be linked, due to the single instance restriction. Since C depends on D, 0.D
406+
-- and 1.D must also be linked. However, C's setup dependency on D should remain
407+
-- independent. The solver should be able to choose D-1 for C's library and D-2
408+
-- for C's setup script.
409+
dbSetupDeps :: ExampleDb
410+
dbSetupDeps = [
411+
Right $ exAv "A" 1 [ExAny "C"]
412+
, Right $ exAv "B" 1 [ExAny "C"]
413+
, Right $ exAv "C" 1 [ExFix "D" 1] `withSetupDeps` [ExFix "D" 2]
414+
, Right $ exAv "D" 1 []
415+
, Right $ exAv "D" 2 []
416+
]
417+
400418
-- | Tests for dealing with base shims
401419
db11 :: ExampleDb
402420
db11 =

0 commit comments

Comments
 (0)