Skip to content

Commit 7e503eb

Browse files
mpickeringalt-romes
authored andcommitted
testsuite: Add some tests for setup component scope interacts with stanza flags
These tests check how the setup qualified scope interacts with the stanza flags (specified on the top-level and with the any qualifier)
1 parent 6c1b1bb commit 7e503eb

File tree

1 file changed

+33
-0
lines changed
  • cabal-install/tests/UnitTests/Distribution/Solver/Modular

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ tests =
182182
, runTest $ mkTest db9 "setupDeps7" ["F", "G"] (solverSuccess [("A", 1), ("B", 1), ("B", 2), ("C", 1), ("D", 1), ("E", 1), ("E", 2), ("F", 1), ("G", 1)])
183183
, runTest $ mkTest db10 "setupDeps8" ["C"] (solverSuccess [("C", 1)])
184184
, runTest $ indep $ mkTest dbSetupDeps "setupDeps9" ["A", "B"] (solverSuccess [("A", 1), ("B", 1), ("C", 1), ("D", 1), ("D", 2)])
185+
, runTest $ setupStanzaTest1
186+
, runTest $ setupStanzaTest2
187+
, runTest $ setupStanzaTest3
185188
]
186189
, testGroup
187190
"Base shim"
@@ -2555,6 +2558,36 @@ dbIssue3775 =
25552558
, Right $ exAv "B" 2 [ExAny "A", ExAny "warp"]
25562559
]
25572560

2561+
-- A database where the setup depends on something which has a test stanza, does the
2562+
-- test stanza get enabled?
2563+
dbSetupStanza :: ExampleDb
2564+
dbSetupStanza =
2565+
[ Right $
2566+
exAv "A" 1 []
2567+
`withSetupDeps` [ExAny "B"]
2568+
, Right $
2569+
exAv "B" 1 []
2570+
`withTest` exTest "test" [ExAny "C"]
2571+
]
2572+
2573+
-- With the user constraint syntax
2574+
setupStanzaTest1 :: SolverTest
2575+
setupStanzaTest1 = userConstraints ["B test"] $ mkTest dbSetupStanza "setupStanzaTest1" ["A"] (solverSuccess [("A", 1), ("B", 1)])
2576+
2577+
-- With the "top-level" qualifier syntax
2578+
setupStanzaTest2 :: SolverTest
2579+
setupStanzaTest2 = constraints [ExStanzaConstraint (scopeToplevel "B") [TestStanzas]] $ mkTest dbSetupStanza "setupStanzaTest2" ["A"] (solverSuccess [("A", 1), ("B", 1)])
2580+
2581+
-- With the "any" qualifier syntax
2582+
setupStanzaTest3 :: SolverTest
2583+
setupStanzaTest3 =
2584+
constraints [ExStanzaConstraint (ScopeAnyQualifier "B") [TestStanzas]] $
2585+
mkTest
2586+
dbSetupStanza
2587+
"setupStanzaTest3"
2588+
["A"]
2589+
(solverFailure ("unknown package: A:setup.C (dependency of A:setup.B *test)" `isInfixOf`))
2590+
25582591
-- | Returns true if the second list contains all elements of the first list, in
25592592
-- order.
25602593
containsInOrder :: Eq a => [a] -> [a] -> Bool

0 commit comments

Comments
 (0)