Skip to content

Commit cdcc760

Browse files
segiddinsmatzbot
authored andcommitted
[rubygems/rubygems] Broader version compatibility in marshal tests
rubygems/rubygems@6ec518c563
1 parent c80a4d4 commit cdcc760

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/rubygems/safe_marshal.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module SafeMarshal
3838

3939
@_zone
4040
@cpu
41+
@debug_created_info
4142
@force_ruby_platform
4243
@marshal_with_utc_coercion
4344
@name

test/rubygems/test_gem_safe_marshal.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,20 @@ def test_string_with_encoding
3939
end
4040

4141
def test_string_with_ivar
42-
assert_safe_load_as String.new("abc").tap { _1.instance_variable_set :@type, "type" }
42+
assert_safe_load_as String.new("abc").tap {|s| s.instance_variable_set :@type, "type" }
4343
end
4444

4545
def test_time_with_ivar
46-
assert_safe_load_as Time.new.tap { _1.instance_variable_set :@type, "type" }
46+
assert_safe_load_as Time.new.tap {|t| t.instance_variable_set :@type, "type" }
4747
end
4848

4949
secs = Time.new(2000, 12, 31, 23, 59, 59).to_i
5050
[
51-
Time.new,
52-
Time.now(in: "+04:00"),
53-
Time.now(in: "-11:52"),
54-
Time.at(secs, in: "UTC"),
51+
Time.at(secs),
52+
Time.at(secs, in: "+04:00"),
53+
Time.at(secs, in: "-11:52"),
54+
Time.at(secs, in: "+00:00"),
55+
Time.at(secs, in: "-00:00"),
5556
Time.at(secs, 1, :millisecond),
5657
Time.at(secs, 1.1, :millisecond),
5758
Time.at(secs, 1.01, :millisecond),
@@ -78,7 +79,7 @@ def test_floats
7879
end
7980

8081
def test_hash_with_ivar
81-
assert_safe_load_as({ runtime: :development }.tap { _1.instance_variable_set :@type, "null" })
82+
assert_safe_load_as({ runtime: :development }.tap {|h| h.instance_variable_set :@type, "null" })
8283
end
8384

8485
def test_hash_with_default_value
@@ -115,7 +116,7 @@ def test_gem_spec_disallowed_symbol
115116
s.name = "hi"
116117
s.version = "1.2.3"
117118

118-
s.dependencies << Gem::Dependency.new("rspec", Gem::Requirement.new([">= 1.2.3"]), :runtime).tap { _1.instance_variable_set(:@name, :rspec) }
119+
s.dependencies << Gem::Dependency.new("rspec", Gem::Requirement.new([">= 1.2.3"]), :runtime).tap {|d| d.instance_variable_set(:@name, :rspec) }
119120
end
120121
Gem::SafeMarshal.safe_load(Marshal.dump(spec))
121122
end

0 commit comments

Comments
 (0)