diff options
author | Samuel Giddins <[email protected]> | 2023-08-18 15:49:59 -0700 |
---|---|---|
committer | git <[email protected]> | 2023-09-20 02:02:59 +0000 |
commit | cdcc760dc0b3ca504b630e333c350da9e97dbbb2 (patch) | |
tree | cc9dd1e6b3e26fbcd5f7a7057a30eade47be1d2d | |
parent | c80a4d453a26c1b5f1b57de31c8d1a2b69133a55 (diff) |
[rubygems/rubygems] Broader version compatibility in marshal tests
https://github.com/rubygems/rubygems/commit/6ec518c563
-rw-r--r-- | lib/rubygems/safe_marshal.rb | 1 | ||||
-rw-r--r-- | test/rubygems/test_gem_safe_marshal.rb | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/rubygems/safe_marshal.rb b/lib/rubygems/safe_marshal.rb index 172b92d5a6..33e56867cd 100644 --- a/lib/rubygems/safe_marshal.rb +++ b/lib/rubygems/safe_marshal.rb @@ -38,6 +38,7 @@ module Gem @_zone @cpu + @debug_created_info @force_ruby_platform @marshal_with_utc_coercion @name diff --git a/test/rubygems/test_gem_safe_marshal.rb b/test/rubygems/test_gem_safe_marshal.rb index 30f30d1b5d..9d29958b59 100644 --- a/test/rubygems/test_gem_safe_marshal.rb +++ b/test/rubygems/test_gem_safe_marshal.rb @@ -39,19 +39,20 @@ class TestGemSafeMarshal < Gem::TestCase end def test_string_with_ivar - assert_safe_load_as String.new("abc").tap { _1.instance_variable_set :@type, "type" } + assert_safe_load_as String.new("abc").tap {|s| s.instance_variable_set :@type, "type" } end def test_time_with_ivar - assert_safe_load_as Time.new.tap { _1.instance_variable_set :@type, "type" } + assert_safe_load_as Time.new.tap {|t| t.instance_variable_set :@type, "type" } end secs = Time.new(2000, 12, 31, 23, 59, 59).to_i [ - Time.new, - Time.now(in: "+04:00"), - Time.now(in: "-11:52"), - Time.at(secs, in: "UTC"), + Time.at(secs), + Time.at(secs, in: "+04:00"), + Time.at(secs, in: "-11:52"), + Time.at(secs, in: "+00:00"), + Time.at(secs, in: "-00:00"), Time.at(secs, 1, :millisecond), Time.at(secs, 1.1, :millisecond), Time.at(secs, 1.01, :millisecond), @@ -78,7 +79,7 @@ class TestGemSafeMarshal < Gem::TestCase end def test_hash_with_ivar - assert_safe_load_as({ runtime: :development }.tap { _1.instance_variable_set :@type, "null" }) + assert_safe_load_as({ runtime: :development }.tap {|h| h.instance_variable_set :@type, "null" }) end def test_hash_with_default_value @@ -115,7 +116,7 @@ class TestGemSafeMarshal < Gem::TestCase s.name = "hi" s.version = "1.2.3" - s.dependencies << Gem::Dependency.new("rspec", Gem::Requirement.new([">= 1.2.3"]), :runtime).tap { _1.instance_variable_set(:@name, :rspec) } + s.dependencies << Gem::Dependency.new("rspec", Gem::Requirement.new([">= 1.2.3"]), :runtime).tap {|d| d.instance_variable_set(:@name, :rspec) } end Gem::SafeMarshal.safe_load(Marshal.dump(spec)) end |