[rubygems/rubygems] Fix line comment issue for map

https://github.com/rubygems/rubygems/commit/7ca06e139b
This commit is contained in:
alpha0x00 2024-07-14 22:01:57 +08:00 committed by git
parent 1c81d1a69d
commit 3222c67262
3 changed files with 6 additions and 2 deletions

View File

@ -41,7 +41,7 @@ module Bundler
HASH_REGEX = /
^
([ ]*) # indentations
(.+) # key
([^#]+) # key excludes comment char '#'
(?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
[ ]?
(['"]?) # optional opening quote

View File

@ -41,7 +41,7 @@ module Gem
HASH_REGEX = /
^
([ ]*) # indentations
(.+) # key
([^#]+) # key excludes comment char '#'
(?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
[ ]?
(['"]?) # optional opening quote

View File

@ -569,10 +569,14 @@ if you believe they were disclosed to a third party.
yaml = <<~YAML
---
:foo: bar # buzz
#:notkey: bar
YAML
actual = Gem::ConfigFile.load_with_rubygems_config_hash(yaml)
assert_equal("bar", actual[:foo])
assert_equal(false, actual.key?("#:notkey"))
assert_equal(false, actual.key?(:notkey))
assert_equal(1, actual.size)
end
def test_s3_source