Skip to content

Commit 573c15d

Browse files
mpickeringMikolaj
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 b169cd4 commit 573c15d

File tree

1 file changed

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

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ 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
185187
]
186188
, testGroup
187189
"Base shim"
@@ -2555,6 +2557,32 @@ dbIssue3775 =
25552557
, Right $ exAv "B" 2 [ExAny "A", ExAny "warp"]
25562558
]
25572559

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

0 commit comments

Comments
 (0)