Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
83f2461e
Commit
83f2461e
authored
Sep 11, 2016
by
kristenk
Browse files
Document how solver quickcheck tests create valid ComponentDeps.
parent
1b0560c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs
View file @
83f2461e
...
...
@@ -224,10 +224,14 @@ arbitraryExInst pn v pkgs = do
arbitraryComponentDeps
::
TestDb
->
Gen
(
ComponentDeps
[
ExampleDependency
])
arbitraryComponentDeps
(
TestDb
[]
)
=
return
$
CD
.
fromList
[]
arbitraryComponentDeps
db
=
CD
.
fromList
.
dedupNamedComponents
<$>
boundedListOf
5
(
arbitraryComponentDep
db
)
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
dedup
Named
Components
=
dedupComponent
Name
s
=
nubBy
((
\
x
y
->
isJust
x
&&
isJust
y
&&
x
==
y
)
`
on
`
componentName
.
fst
)
componentName
::
Component
->
Maybe
String
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment