Skip to content

Add unit tests for the solver's "rejecting" message with multiple versions #11012

Open
@sebright

Description

@sebright

Tests of the solver's current "rejecting" message would help us track progress on #4251. These tests could go in cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs, where we already have tests for other messages, such as

[ -- Skipping a version because of a problematic dependency:
--
-- When the solver explores A-4, it finds that it cannot satisfy B's
-- dependencies. This allows the solver to skip the subsequent
-- versions of A that also depend on B.
runTest $
let db =
[ Right $ exAv "A" 4 [ExAny "B"]
, Right $ exAv "A" 3 [ExAny "B"]
, Right $ exAv "A" 2 [ExAny "B"]
, Right $ exAv "A" 1 []
, Right $ exAv "B" 2 [ExAny "unknown1"]
, Right $ exAv "B" 1 [ExAny "unknown2"]
]
msg =
[ "[__0] trying: A-4.0.0 (user goal)"
, "[__1] trying: B-2.0.0 (dependency of A)"
, "[__2] unknown package: unknown1 (dependency of B)"
, "[__2] fail (backjumping, conflict set: B, unknown1)"
, "[__1] trying: B-1.0.0"
, "[__2] unknown package: unknown2 (dependency of B)"
, "[__2] fail (backjumping, conflict set: B, unknown2)"
, "[__1] fail (backjumping, conflict set: A, B, unknown1, unknown2)"
, "[__0] skipping: A; 3.0.0, 2.0.0 (has the same characteristics that "
++ "caused the previous version to fail: depends on 'B')"
, "[__0] trying: A-1.0.0"
, "[__1] done"
]
in setVerbose $
mkTest db "skip version due to problematic dependency" ["A"] $
SolverResult (isInfixOf msg) $
Right [("A", 1)]

Here are some cases to test:

  • Rejecting multiple versions
  • Rejecting versions that aren't in order, using preferences
  • Rejecting source and installed versions
  • Rejecting linked instances, using setup or build-tool dependencies

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions