diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-19 19:51:20 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-20 20:12:45 +0900 |
| commit | 812272bdb2e2f68baa7da4b0a977bd898864a7f8 (patch) | |
| tree | 92706f93451325824a839ed0dd7a50a058cecb39 /test/ruby | |
| parent | f0923164d8a32064cec53386f48dc0c340b9a15c (diff) | |
Tempfile is not needed
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_marshal.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 6cd0b9acc3..13645e3aa8 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -1,6 +1,5 @@ # frozen_string_literal: false require 'test/unit' -require 'tempfile' require_relative 'marshaltestlib' class TestMarshal < Test::Unit::TestCase @@ -314,11 +313,10 @@ class TestMarshal < Test::Unit::TestCase assert_equal(c, Marshal.load(Marshal.dump(c)), bug2109) assert_nothing_raised(ArgumentError, '[ruby-dev:40386]') do - re = Tempfile.create("marshal_regexp") do |f| - f.binmode.write("\x04\bI/\x00\x00\x06:\rencoding\"\rUS-ASCII") - f.rewind - re2 = Marshal.load(f) - re2 + re = IO.pipe do |r, w| + w.write("\x04\bI/\x00\x00\x06:\rencoding\"\rUS-ASCII") + # Marshal.load would not overread and block + Marshal.load(r) end assert_equal(//, re) end |
