mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Add Gem::Dependency#identity method
https://github.com/rubygems/rubygems/commit/05146bb2fd
This commit is contained in:
parent
871005bdd2
commit
b659c1b92f
2 changed files with 21 additions and 0 deletions
|
@ -334,4 +334,18 @@ class Gem::Dependency
|
|||
matches.first
|
||||
end
|
||||
|
||||
def identity
|
||||
if prerelease?
|
||||
if specific?
|
||||
:complete
|
||||
else
|
||||
:abs_latest
|
||||
end
|
||||
elsif latest_version?
|
||||
:latest
|
||||
else
|
||||
:released
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -385,4 +385,11 @@ class TestGemDependency < Gem::TestCase
|
|||
assert_match "Could not find 'b' (= 2.0) among 1 total gem(s)", e.message
|
||||
end
|
||||
|
||||
def test_identity
|
||||
assert_equal dep("a", "= 1").identity, :released
|
||||
assert_equal dep("a", "= 1.a").identity, :complete
|
||||
assert_equal dep("a", " >= 1.a").identity, :abs_latest
|
||||
assert_equal dep("a").identity, :latest
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue