Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Nov 9, 2024
1 parent 5181892 commit 522bec9
Show file tree
Hide file tree
Showing 23 changed files with 634 additions and 216 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveDataTypeable #-}

module Distribution.Solver.Types.SourcePackage
( PackageDescriptionOverride
, SourcePackage(..)
Expand All @@ -25,7 +27,7 @@ data SourcePackage loc = SourcePackage
, srcpkgSource :: loc
, srcpkgDescrOverride :: PackageDescriptionOverride
}
deriving (Eq, Show, Generic, Typeable)
deriving (Eq, Show, Functor, Generic, Typeable)

instance Binary loc => Binary (SourcePackage loc)
instance Structured loc => Structured (SourcePackage loc)
Expand Down
10 changes: 5 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,23 +1286,23 @@ legacyProjectConfigFieldDescrs :: ConstraintSource -> [FieldDescr LegacyProjectC
legacyProjectConfigFieldDescrs constraintSrc =
[ newLineListField
"packages"
(pretty . fmap (Disp.text . renderPackageLocationToken))
(Disp.text . renderPackageLocationToken . constraintPackage)
( (\pkg -> WithConstraintSource{constraintPackage = pkg, constraintConstraint = constraintSrc})
`fmap` parsePackageLocationTokenQ
)
legacyPackages
(\v flags -> flags{legacyPackages = v})
, newLineListField
"optional-packages"
(pretty . fmap (Disp.text . renderPackageLocationToken))
(Disp.text . renderPackageLocationToken . constraintPackage)
( (\pkg -> WithConstraintSource{constraintPackage = pkg, constraintConstraint = constraintSrc})
`fmap` parsePackageLocationTokenQ
)
legacyPackagesOptional
(\v flags -> flags{legacyPackagesOptional = v})
, commaNewLineListFieldParsec
"extra-packages"
pretty
(pretty . constraintPackage)
( (\pkg -> WithConstraintSource{constraintPackage = pkg, constraintConstraint = constraintSrc})
`fmap` parsec
)
Expand Down Expand Up @@ -1424,15 +1424,15 @@ legacySharedConfigFieldDescrs constraintSrc =
. addFields
[ commaNewLineListFieldParsec
"constraints"
pretty
(pretty . constraintPackage)
( (\constraint -> WithConstraintSource{constraintPackage = constraint, constraintConstraint = constraintSrc})
`fmap` parsec
)
configExConstraints
(\v conf -> conf{configExConstraints = v})
, commaNewLineListFieldParsec
"preferences"
pretty
(pretty . constraintPackage)
( (\preference -> WithConstraintSource{constraintPackage = preference, constraintConstraint = constraintSrc})
`fmap` parsec
)
Expand Down
Loading

0 comments on commit 522bec9

Please sign in to comment.