diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-13 05:41:44 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-13 05:41:44 +0000 |
commit | 1474dd064b28e4a813a79342c5523cede60f83c7 (patch) | |
tree | 18eed509f9c6e01f993948b733c165f6006a2450 /test/ruby/test_marshal.rb | |
parent | 90026ab53f89304438d907c0c7cc23afccc6edb7 (diff) | |
download | ruby-1474dd064b28e4a813a79342c5523cede60f83c7.tar.gz |
* test/-ext-/test_printf.rb, test/rss/test_parser.rb,
test/ruby/test_array.rb, test/ruby/test_hash.rb,
test/ruby/test_m17n.rb, test/ruby/test_marshal.rb,
test/ruby/test_object.rb, test/ruby/test_string.rb: don't use
untrusted?, untrust, and trust to avoid warnings in case $VERBOSE is
true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_marshal.rb')
-rw-r--r-- | test/ruby/test_marshal.rb | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index b0f066a5a3..f502026cdf 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -187,80 +187,55 @@ class TestMarshal < Test::Unit::TestCase end end - def test_taint_and_untrust + def test_taint x = Object.new x.taint - x.untrust s = Marshal.dump(x) assert_equal(true, s.tainted?) - assert_equal(true, s.untrusted?) y = Marshal.load(s) assert_equal(true, y.tainted?) - assert_equal(true, y.untrusted?) end - def test_taint_and_untrust_each_object + def test_taint_each_object x = Object.new obj = [[x]] # clean object causes crean stream assert_equal(false, obj.tainted?) - assert_equal(false, obj.untrusted?) assert_equal(false, obj.first.tainted?) - assert_equal(false, obj.first.untrusted?) assert_equal(false, obj.first.first.tainted?) - assert_equal(false, obj.first.first.untrusted?) s = Marshal.dump(obj) assert_equal(false, s.tainted?) - assert_equal(false, s.untrusted?) - # tainted/untrusted object causes tainted/untrusted stream + # tainted object causes tainted stream x.taint - x.untrust assert_equal(false, obj.tainted?) - assert_equal(false, obj.untrusted?) assert_equal(false, obj.first.tainted?) - assert_equal(false, obj.first.untrusted?) assert_equal(true, obj.first.first.tainted?) - assert_equal(true, obj.first.first.untrusted?) t = Marshal.dump(obj) assert_equal(true, t.tainted?) - assert_equal(true, t.untrusted?) # clean stream causes clean objects assert_equal(false, s.tainted?) - assert_equal(false, s.untrusted?) y = Marshal.load(s) assert_equal(false, y.tainted?) - assert_equal(false, y.untrusted?) assert_equal(false, y.first.tainted?) - assert_equal(false, y.first.untrusted?) assert_equal(false, y.first.first.tainted?) - assert_equal(false, y.first.first.untrusted?) - # tainted/untrusted stream causes tainted/untrusted objects + # tainted stream causes tainted objects assert_equal(true, t.tainted?) - assert_equal(true, t.untrusted?) y = Marshal.load(t) assert_equal(true, y.tainted?) - assert_equal(true, y.untrusted?) assert_equal(true, y.first.tainted?) - assert_equal(true, y.first.untrusted?) assert_equal(true, y.first.first.tainted?) - assert_equal(true, y.first.first.untrusted?) # same tests by different senario s.taint - s.untrust assert_equal(true, s.tainted?) - assert_equal(true, s.untrusted?) y = Marshal.load(s) assert_equal(true, y.tainted?) - assert_equal(true, y.untrusted?) assert_equal(true, y.first.tainted?) - assert_equal(true, y.first.untrusted?) assert_equal(true, y.first.first.tainted?) - assert_equal(true, y.first.first.untrusted?) end def test_symbol2 @@ -511,11 +486,9 @@ class TestMarshal < Test::Unit::TestCase bug7325 = '[ruby-core:49198]' for c in [TestClass, TestModule] assert(!c.tainted?) - assert(!c.untrusted?) - c2 = Marshal.load(Marshal.dump(c).taint.untrust) + c2 = Marshal.load(Marshal.dump(c).taint) assert_same(c, c2) assert(!c.tainted?, bug7325) - assert(!c.untrusted?, bug7325) end end |