diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-13 15:14:02 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-13 15:14:02 +0000 |
commit | 24d2be663a14e44f76ac19470044f136c5fd0ade (patch) | |
tree | 998f6fc45edc84dc22e05d82a09711c583fcc8e7 /test | |
parent | 08759d1f0abcd9829becff4178858ffd5dbc6c71 (diff) |
merge revision(s) 25230,25995:
* marshal.c (struct {dump,load}_arg): manage with dfree, instead
of using local variable which may be moved by context switch.
[ruby-dev:39425]
* marshal.c (marshal_load): should set taintness. [ruby-dev:39723]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_marshal.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 68f50ff728..d40c9da4d4 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -71,4 +71,41 @@ class TestMarshal < Test::Unit::TestCase } assert_equal("marshal data too short", e.message) end + + class DumpTest + def marshal_dump + loop { Thread.pass } + end + end + + class LoadTest + def marshal_dump + nil + end + def marshal_load(obj) + loop { Thread.pass } + end + end + + def test_context_switch + o = DumpTest.new + Thread.new { Marshal.dump(o) } + GC.start + assert(true, '[ruby-dev:39425]') + + o = LoadTest.new + m = Marshal.dump(o) + Thread.new { Marshal.load(m) } + GC.start + assert(true, '[ruby-dev:39425]') + end + + def test_taint + x = Object.new + x.taint + s = Marshal.dump(x) + assert_equal(true, s.tainted?) + y = Marshal.load(s) + assert_equal(true, y.tainted?) + end end |