2016-02-01 15:43:26 +03:00
|
|
|
# frozen_string_literal: true
|
2013-07-10 03:21:36 +04:00
|
|
|
require 'rubygems/test_case'
|
|
|
|
|
2013-11-19 04:34:13 +04:00
|
|
|
class TestGemResolverConflict < Gem::TestCase
|
2013-07-10 03:21:36 +04:00
|
|
|
def test_explanation
|
|
|
|
root =
|
|
|
|
dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
|
2013-07-10 03:41:44 +04:00
|
|
|
child =
|
2013-07-10 03:21:36 +04:00
|
|
|
dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', root
|
|
|
|
|
2013-11-22 03:27:30 +04:00
|
|
|
dep = Gem::Resolver::DependencyRequest.new dep('net-ssh', '>= 2.0.13'), nil
|
|
|
|
|
2017-10-08 04:32:18 +03:00
|
|
|
spec = util_spec 'net-ssh', '2.2.2'
|
2013-11-22 03:27:30 +04:00
|
|
|
active =
|
|
|
|
Gem::Resolver::ActivationRequest.new spec, dep
|
|
|
|
|
2013-07-10 03:21:36 +04:00
|
|
|
conflict =
|
2013-11-22 03:27:30 +04:00
|
|
|
Gem::Resolver::Conflict.new child, active
|
2013-07-10 03:21:36 +04:00
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
2014-09-14 07:30:02 +04:00
|
|
|
Activated net-ssh-2.2.2
|
|
|
|
which does not match conflicting dependency (>= 2.6.5)
|
|
|
|
|
|
|
|
Conflicting dependency chains:
|
|
|
|
net-ssh (>= 2.0.13), 2.2.2 activated
|
|
|
|
|
|
|
|
versus:
|
|
|
|
rye (= 0.9.8), 0.9.8 activated, depends on
|
|
|
|
net-ssh (>= 2.0.13), 2.2.2 activated, depends on
|
|
|
|
net-ssh (>= 2.6.5)
|
|
|
|
|
2013-07-10 03:21:36 +04:00
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, conflict.explanation
|
|
|
|
end
|
|
|
|
|
2013-11-10 21:51:40 +04:00
|
|
|
def test_explanation_user_request
|
2013-11-19 04:34:13 +04:00
|
|
|
@DR = Gem::Resolver
|
2013-11-10 21:51:40 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
spec = util_spec 'a', 2
|
2013-11-10 21:51:40 +04:00
|
|
|
|
|
|
|
a1_req = @DR::DependencyRequest.new dep('a', '= 1'), nil
|
|
|
|
a2_req = @DR::DependencyRequest.new dep('a', '= 2'), nil
|
|
|
|
|
|
|
|
activated = @DR::ActivationRequest.new spec, a2_req
|
|
|
|
|
2013-11-19 04:34:13 +04:00
|
|
|
conflict = @DR::Conflict.new a1_req, activated
|
2013-11-10 21:51:40 +04:00
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
2014-09-14 07:30:02 +04:00
|
|
|
Activated a-2
|
|
|
|
which does not match conflicting dependency (= 1)
|
|
|
|
|
|
|
|
Conflicting dependency chains:
|
|
|
|
a (= 2), 2 activated
|
|
|
|
|
|
|
|
versus:
|
|
|
|
a (= 1)
|
|
|
|
|
2013-11-10 21:51:40 +04:00
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, conflict.explanation
|
|
|
|
end
|
|
|
|
|
2013-07-10 03:21:36 +04:00
|
|
|
def test_request_path
|
|
|
|
root =
|
|
|
|
dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
|
2013-11-22 03:27:30 +04:00
|
|
|
|
2013-07-10 03:41:44 +04:00
|
|
|
child =
|
2013-11-22 03:27:30 +04:00
|
|
|
dependency_request dep('other', '>= 1.0'), 'net-ssh', '2.2.2', root
|
2013-07-10 03:21:36 +04:00
|
|
|
|
|
|
|
conflict =
|
2013-11-22 03:27:30 +04:00
|
|
|
Gem::Resolver::Conflict.new nil, nil
|
|
|
|
|
|
|
|
expected = [
|
2014-09-14 07:30:02 +04:00
|
|
|
'net-ssh (>= 2.0.13), 2.2.2 activated',
|
2020-12-08 10:33:39 +03:00
|
|
|
'rye (= 0.9.8), 0.9.8 activated',
|
2013-11-22 03:27:30 +04:00
|
|
|
]
|
2013-07-10 03:21:36 +04:00
|
|
|
|
2013-11-22 03:27:30 +04:00
|
|
|
assert_equal expected, conflict.request_path(child.requester)
|
2013-07-10 03:21:36 +04:00
|
|
|
end
|
|
|
|
end
|