@@ -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"
@@ -2518,6 +2521,36 @@ dbIssue3775 =
2518
2521
, Right $ exAv " B" 2 [ExAny " A" , ExAny " warp" ]
2519
2522
]
2520
2523
2524
+ -- A database where the setup depends on something which has a test stanza, does the
2525
+ -- test stanza get enabled?
2526
+ dbSetupStanza :: ExampleDb
2527
+ dbSetupStanza =
2528
+ [ Right $
2529
+ exAv " A" 1 []
2530
+ `withSetupDeps` [ExAny " B" ]
2531
+ , Right $
2532
+ exAv " B" 1 []
2533
+ `withTest` exTest " test" [ExAny " C" ]
2534
+ ]
2535
+
2536
+ -- With the user constraint syntax (fails)
2537
+ setupStanzaTest1 :: SolverTest
2538
+ setupStanzaTest1 = userConstraints [" B test" ] $ mkTest dbSetupStanza " setupStanzaTest1" [" A" ] (solverSuccess [(" A" , 1 ), (" B" , 1 )])
2539
+
2540
+ -- With the "top-level" qualifier syntax
2541
+ setupStanzaTest2 :: SolverTest
2542
+ setupStanzaTest2 = constraints [ExStanzaConstraint (scopeToplevel " B" ) [TestStanzas ]] $ mkTest dbSetupStanza " setupStanzaTest2" [" A" ] (solverSuccess [(" A" , 1 ), (" B" , 1 )])
2543
+
2544
+ -- With the "any" qualifier syntax
2545
+ setupStanzaTest3 :: SolverTest
2546
+ setupStanzaTest3 =
2547
+ constraints [ExStanzaConstraint (ScopeAnyQualifier " B" ) [TestStanzas ]] $
2548
+ mkTest
2549
+ dbSetupStanza
2550
+ " setupStanzaTest3"
2551
+ [" A" ]
2552
+ (solverFailure (" unknown package: A:setup.C (dependency of A:setup.B *test)" `isInfixOf` ))
2553
+
2521
2554
-- | Returns true if the second list contains all elements of the first list, in
2522
2555
-- order.
2523
2556
containsInOrder :: Eq a => [a ] -> [a ] -> Bool
0 commit comments