Commit 83f2461e authored by kristenk's avatar kristenk
Browse files

Document how solver quickcheck tests create valid ComponentDeps.

parent 1b0560c6
......@@ -224,10 +224,14 @@ arbitraryExInst pn v pkgs = do
arbitraryComponentDeps :: TestDb -> Gen (ComponentDeps [ExampleDependency])
arbitraryComponentDeps (TestDb []) = return $ CD.fromList []
arbitraryComponentDeps db = CD.fromList . dedupNamedComponents <$>
arbitraryComponentDeps db =
-- dedupComponentNames removes components with duplicate names, for example,
-- 'ComponentExe x' and 'ComponentTest x', and then CD.fromList combines
-- duplicate unnamed components.
CD.fromList . dedupComponentNames <$>
boundedListOf 5 (arbitraryComponentDep db)
where
dedupNamedComponents =
dedupComponentNames =
nubBy ((\x y -> isJust x && isJust y && x == y) `on` componentName . fst)
componentName :: Component -> Maybe String
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment