1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
require 'rubygems/test_case'
class TestGemResolverConflict < Gem::TestCase
def test_self_compatibility
assert_same Gem::Resolver::Conflict, Gem::Resolver::DependencyConflict
end
def test_explanation
root =
dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
child =
dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', root
dep = Gem::Resolver::DependencyRequest.new dep('net-ssh', '>= 2.0.13'), nil
spec = quick_spec 'net-ssh', '2.2.2'
active =
Gem::Resolver::ActivationRequest.new spec, dep
conflict =
Gem::Resolver::Conflict.new child, active
expected = <<-EXPECTED
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)
EXPECTED
assert_equal expected, conflict.explanation
end
def test_explanation_user_request
@DR = Gem::Resolver
spec = util_spec 'a', 2
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
conflict = @DR::Conflict.new a1_req, activated
expected = <<-EXPECTED
Activated a-2
which does not match conflicting dependency (= 1)
Conflicting dependency chains:
a (= 2), 2 activated
versus:
a (= 1)
EXPECTED
assert_equal expected, conflict.explanation
end
def test_request_path
root =
dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
child =
dependency_request dep('other', '>= 1.0'), 'net-ssh', '2.2.2', root
conflict =
Gem::Resolver::Conflict.new nil, nil
expected = [
'net-ssh (>= 2.0.13), 2.2.2 activated',
'rye (= 0.9.8), 0.9.8 activated'
]
assert_equal expected, conflict.request_path(child.requester)
end
end
|