1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Replace unpack with unpack1

This commit is contained in:
Nobuyoshi Nakada 2021-10-17 00:46:25 +09:00
parent cc8ff8b50d
commit 5de6e25144
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
3 changed files with 10 additions and 10 deletions

View file

@ -574,9 +574,9 @@ module Test
jobs_status(worker)
when /^done (.+?)$/
begin
r = Marshal.load($1.unpack("m")[0])
r = Marshal.load($1.unpack1("m"))
rescue
print "unknown object: #{$1.unpack("m")[0].dump}"
print "unknown object: #{$1.unpack1("m").dump}"
return true
end
result << r[0..1] unless r[0..1] == [nil,nil]
@ -587,7 +587,7 @@ module Test
return true
when /^record (.+?)$/
begin
r = Marshal.load($1.unpack("m")[0])
r = Marshal.load($1.unpack1("m"))
suite = r.first
key = [worker.name, suite]
@ -597,18 +597,18 @@ module Test
@records[key] = [worker.start_time, Time.now]
end
rescue => e
print "unknown record: #{e.message} #{$1.unpack("m")[0].dump}"
print "unknown record: #{e.message} #{$1.unpack1("m").dump}"
return true
end
record(fake_class(r[0]), *r[1..-1])
when /^p (.+?)$/
del_jobs_status
print $1.unpack("m")[0]
print $1.unpack1("m")
jobs_status(worker) if @options[:job_status] == :replace
when /^after (.+?)$/
@warnings << Marshal.load($1.unpack("m")[0])
@warnings << Marshal.load($1.unpack1("m"))
when /^bye (.+?)$/
after_worker_down worker, Marshal.load($1.unpack("m")[0])
after_worker_down worker, Marshal.load($1.unpack1("m"))
when /^bye$/, nil
if shutting_down || worker.quit_called
after_worker_quit worker

View file

@ -107,7 +107,7 @@ module Test
case buf.chomp
when /^loadpath (.+?)$/
@old_loadpath = $:.dup
$:.push(*Marshal.load($1.unpack("m")[0].force_encoding("ASCII-8BIT"))).uniq!
$:.push(*Marshal.load($1.unpack1("m").force_encoding("ASCII-8BIT"))).uniq!
when /^run (.+?) (.+?)$/
_report "okay"

View file

@ -99,7 +99,7 @@ module TestParallel
break if /^p (.+?)$/ =~ buf
end
assert_not_nil($1, "'p' was not found")
assert_match(/TestA#test_nothing_test = \d+\.\d+ s = \.\n/, $1.chomp.unpack("m")[0])
assert_match(/TestA#test_nothing_test = \d+\.\d+ s = \.\n/, $1.chomp.unpack1("m"))
end
end
@ -111,7 +111,7 @@ module TestParallel
end
assert_not_nil($1, "'done' was not found")
result = Marshal.load($1.chomp.unpack("m")[0])
result = Marshal.load($1.chomp.unpack1("m"))
assert_equal(5, result[0])
pend "TODO: result[1] returns 17. We should investigate it" do
assert_equal(12, result[1])