@@ -182,6 +182,9 @@ tests =
182
182
, 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 )])
183
183
, runTest $ mkTest db10 " setupDeps8" [" C" ] (solverSuccess [(" C" , 1 )])
184
184
, 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
185
188
]
186
189
, testGroup
187
190
" Base shim"
@@ -2555,6 +2558,36 @@ dbIssue3775 =
2555
2558
, Right $ exAv " B" 2 [ExAny " A" , ExAny " warp" ]
2556
2559
]
2557
2560
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
+
2558
2591
-- | Returns true if the second list contains all elements of the first list, in
2559
2592
-- order.
2560
2593
containsInOrder :: Eq a => [a ] -> [a ] -> Bool
0 commit comments