Skip to content

Commit

Permalink
testsuite: Add some tests for setup component scope interacts with st…
Browse files Browse the repository at this point in the history
…anza flags

These tests check how the setup qualified scope interacts with the
stanza flags (specified on the top-level and with the any qualifier)
  • Loading branch information
mpickering authored and Mikolaj committed Apr 7, 2024
1 parent b169cd4 commit 573c15d
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ tests =
, 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)])
, runTest $ mkTest db10 "setupDeps8" ["C"] (solverSuccess [("C", 1)])
, runTest $ indep $ mkTest dbSetupDeps "setupDeps9" ["A", "B"] (solverSuccess [("A", 1), ("B", 1), ("C", 1), ("D", 1), ("D", 2)])
, runTest $ setupStanzaTest1
, runTest $ setupStanzaTest2
]
, testGroup
"Base shim"
Expand Down Expand Up @@ -2555,6 +2557,32 @@ dbIssue3775 =
, Right $ exAv "B" 2 [ExAny "A", ExAny "warp"]
]

-- A database where the setup depends on something which has a test stanza, does the
-- test stanza get enabled?
dbSetupStanza :: ExampleDb
dbSetupStanza =
[ Right $
exAv "A" 1 []
`withSetupDeps` [ExAny "B"]
, Right $
exAv "B" 1 []
`withTest` exTest "test" [ExAny "C"]
]

-- With the "top-level" qualifier syntax
setupStanzaTest1 :: SolverTest
setupStanzaTest1 = constraints [ExStanzaConstraint (scopeToplevel "B") [TestStanzas]] $ mkTest dbSetupStanza "setupStanzaTest1" ["A"] (solverSuccess [("A", 1), ("B", 1)])

-- With the "any" qualifier syntax
setupStanzaTest2 :: SolverTest
setupStanzaTest2 =
constraints [ExStanzaConstraint (ScopeAnyQualifier "B") [TestStanzas]] $
mkTest
dbSetupStanza
"setupStanzaTest2"
["A"]
(solverFailure ("unknown package: A:setup.C (dependency of A:setup.B *test)" `isInfixOf`))

-- | Returns true if the second list contains all elements of the first list, in
-- order.
containsInOrder :: Eq a => [a] -> [a] -> Bool
Expand Down

0 comments on commit 573c15d

Please sign in to comment.