1
0
Fork 0
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:
Jean Boussier 2020-07-23 15:11:24 +02:00 committed by Hiroshi SHIBATA
parent 1a935606b5
commit 561576367b
Notes: git 2020-07-31 21:08:23 +09:00
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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,