diff options
| author | Samuel Giddins <segiddins@segiddins.me> | 2023-08-17 15:38:53 -0700 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-08-20 09:05:17 +0000 |
| commit | 1935433f5f6fecc786955dcf80e8f65ada6bcaeb (patch) | |
| tree | 89dbdd575507c83e6c0cb6803af1d60995424be5 /test | |
| parent | f69f775f243ba2036b1b24a2beda1ca932040982 (diff) | |
[rubygems/rubygems] Ensure that loading multiple gemspecs with legacy YAML class references does not warn
Before this, you would get constant redefinition warnings on Psych::DefaultKey
Additionally, ensure the retries wont continue infinitely in the case of the ArgumentError not being caused by Marshal trying to load the undefined classes
https://github.com/rubygems/rubygems/commit/919e8c2de4
Diffstat (limited to 'test')
| -rw-r--r-- | test/rubygems/test_gem_specification.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 9e68c40b7c..d37e1d1571 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -1094,6 +1094,25 @@ dependencies: [] assert_equal(yaml_defined, Object.const_defined?("YAML")) end + def test_handles_dependencies_with_other_syck_requirements_argument_error + yaml_defined = Object.const_defined?("YAML") + + data = Marshal.dump(Gem::Specification.new do |s| + v = Gem::Version.allocate + v.instance_variable_set :@version, "YAML::Syck::DefaultKey" + s.instance_variable_set :@version, v + end) + + assert_raises(ArgumentError) { Marshal.load(data) } + out, err = capture_output do + assert_raises(ArgumentError) { Marshal.load(data) } + end + assert_empty out + assert_empty err + + assert_equal(yaml_defined, Object.const_defined?("YAML")) + end + def test_initialize spec = Gem::Specification.new do |s| s.name = "blah" |
