mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ruby/test_marshal.rb: close pipes
* test/ruby/test_marshal.rb (TestMarshal#test_pipe): should close pipes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
068253783e
commit
498a001fa7
1 changed files with 8 additions and 8 deletions
|
@ -103,16 +103,16 @@ class TestMarshal < Test::Unit::TestCase
|
||||||
def test_pipe
|
def test_pipe
|
||||||
o1 = C.new("a" * 10000)
|
o1 = C.new("a" * 10000)
|
||||||
|
|
||||||
r, w = IO.pipe
|
o2 = IO.pipe do |r, w|
|
||||||
t = Thread.new { Marshal.load(r) }
|
Thread.new {Marshal.dump(o1, w)}
|
||||||
Marshal.dump(o1, w)
|
Marshal.load(r)
|
||||||
o2 = t.value
|
end
|
||||||
assert_equal(o1.str, o2.str)
|
assert_equal(o1.str, o2.str)
|
||||||
|
|
||||||
r, w = IO.pipe
|
o2 = IO.pipe do |r, w|
|
||||||
t = Thread.new { Marshal.load(r) }
|
Thread.new {Marshal.dump(o1, w, 2)}
|
||||||
Marshal.dump(o1, w, 2)
|
Marshal.load(r)
|
||||||
o2 = t.value
|
end
|
||||||
assert_equal(o1.str, o2.str)
|
assert_equal(o1.str, o2.str)
|
||||||
|
|
||||||
assert_raise(TypeError) { Marshal.dump("foo", Object.new) }
|
assert_raise(TypeError) { Marshal.dump("foo", Object.new) }
|
||||||
|
|
Loading…
Reference in a new issue