mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Deduplicate the requirement operators in memory
https://github.com/rubygems/rubygems/commit/9963d33cf2
This commit is contained in:
parent
1a935606b5
commit
561576367b
Notes:
git
2020-07-31 21:08:23 +09:00
2 changed files with 7 additions and 1 deletions
|
@ -111,7 +111,7 @@ class Gem::Requirement
|
|||
elsif $1 == ">=" && $2 == "0.a"
|
||||
DefaultPrereleaseRequirement
|
||||
else
|
||||
[$1 || "=", Gem::Version.new($2)]
|
||||
[-($1 || "="), Gem::Version.new($2)]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -81,6 +81,12 @@ class TestGemRequirement < Gem::TestCase
|
|||
Gem::Requirement.parse(Gem::Version.new('2'))
|
||||
end
|
||||
|
||||
if RUBY_VERSION >= '2.5'
|
||||
def test_parse_deduplication
|
||||
assert_same '~>', Gem::Requirement.parse('~> 1').first
|
||||
end
|
||||
end
|
||||
|
||||
def test_parse_bad
|
||||
[
|
||||
nil,
|
||||
|
|
Loading…
Reference in a new issue