Skip to content
GitLab
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
c0028c4c
Commit
c0028c4c
authored
Oct 02, 2016
by
kristenk
Browse files
Add tests for stanza preferences.
parent
8ea6f6d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs
View file @
c0028c4c
...
...
@@ -110,7 +110,7 @@ tests = [
,
runTest
$
mkTestLangs
[
Haskell98
,
Haskell2010
,
UnknownLanguage
"Haskell3000"
]
dbLangs1
"supportedUnknown"
[
"C"
]
(
solverSuccess
[(
"A"
,
1
),(
"B"
,
1
),(
"C"
,
1
)])
]
,
testGroup
"
Soft Constraint
s"
[
,
testGroup
"
Package Preference
s"
[
runTest
$
preferences
[
ExPkgPref
"A"
$
mkvrThis
1
]
$
mkTest
db13
"selectPreferredVersionSimple"
[
"A"
]
(
solverSuccess
[(
"A"
,
1
)])
,
runTest
$
preferences
[
ExPkgPref
"A"
$
mkvrOrEarlier
2
]
$
mkTest
db13
"selectPreferredVersionSimple2"
[
"A"
]
(
solverSuccess
[(
"A"
,
2
)])
,
runTest
$
preferences
[
ExPkgPref
"A"
$
mkvrOrEarlier
2
...
...
@@ -122,6 +122,19 @@ tests = [
,
runTest
$
preferences
[
ExPkgPref
"A"
$
mkvrThis
1
,
ExPkgPref
"A"
$
mkvrOrEarlier
2
]
$
mkTest
db13
"selectPreferredVersionMultiple4"
[
"A"
]
(
solverSuccess
[(
"A"
,
1
)])
]
,
testGroup
"Stanza Preferences"
[
runTest
$
mkTest
dbStanzaPreferences1
"disable tests by default"
[
"pkg"
]
$
solverSuccess
[(
"pkg"
,
1
)]
,
runTest
$
preferences
[
ExStanzaPref
"pkg"
[
TestStanzas
]]
$
mkTest
dbStanzaPreferences1
"enable tests with testing preference"
[
"pkg"
]
$
solverSuccess
[(
"pkg"
,
1
),
(
"test-dep"
,
1
)]
,
runTest
$
preferences
[
ExStanzaPref
"pkg"
[
TestStanzas
]]
$
mkTest
dbStanzaPreferences2
"disable testing when it's not possible"
[
"pkg"
]
$
solverSuccess
[(
"pkg"
,
1
)]
]
,
testGroup
"Buildable Field"
[
testBuildable
"avoid building component with unknown dependency"
(
ExAny
"unknown"
)
,
testBuildable
"avoid building component with unknown extension"
(
ExExt
(
UnknownExtension
"unknown"
))
...
...
@@ -611,6 +624,17 @@ db13 = [
,
Right
$
exAv
"A"
3
[]
]
dbStanzaPreferences1
::
ExampleDb
dbStanzaPreferences1
=
[
Right
$
exAv
"pkg"
1
[]
`
withTest
`
ExTest
"test"
[
ExAny
"test-dep"
]
,
Right
$
exAv
"test-dep"
1
[]
]
dbStanzaPreferences2
::
ExampleDb
dbStanzaPreferences2
=
[
Right
$
exAv
"pkg"
1
[]
`
withTest
`
ExTest
"test"
[
ExAny
"unknown"
]
]
-- | Database with some cycles
--
-- * Simplest non-trivial cycle: A -> B and B -> A
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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