mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
90026ab53f
commit
1474dd064b
9 changed files with 82 additions and 149 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Thu Jun 13 14:39:08 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@ruby-lang.org>
|
Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
|
* bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
|
||||||
|
|
|
@ -37,13 +37,4 @@ class Test_SPrintf < Test::Unit::TestCase
|
||||||
inspect: Bug::Printf.v(obj).tainted?,
|
inspect: Bug::Printf.v(obj).tainted?,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_untrust
|
|
||||||
obj = Object.new.untrust
|
|
||||||
assert_equal({to_s: true, inspect: true},
|
|
||||||
{
|
|
||||||
to_s: Bug::Printf.s(obj).untrusted?,
|
|
||||||
inspect: Bug::Printf.v(obj).untrusted?,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ EOR
|
||||||
@rss_tmp = Tempfile.new(%w"rss10- .rdf")
|
@rss_tmp = Tempfile.new(%w"rss10- .rdf")
|
||||||
@rss_tmp.print(@rss10)
|
@rss_tmp.print(@rss10)
|
||||||
@rss_tmp.close
|
@rss_tmp.close
|
||||||
@rss_file = @rss_tmp.path.untaint.trust
|
@rss_file = @rss_tmp.path.untaint
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|
|
@ -476,20 +476,16 @@ class TestArray < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_clone
|
def test_clone
|
||||||
for taint in [ false, true ]
|
for taint in [ false, true ]
|
||||||
for untrust in [ false, true ]
|
for frozen in [ false, true ]
|
||||||
for frozen in [ false, true ]
|
a = @cls[*(0..99).to_a]
|
||||||
a = @cls[*(0..99).to_a]
|
a.taint if taint
|
||||||
a.taint if taint
|
a.freeze if frozen
|
||||||
a.untrust if untrust
|
b = a.clone
|
||||||
a.freeze if frozen
|
|
||||||
b = a.clone
|
|
||||||
|
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
assert_not_equal(a.__id__, b.__id__)
|
assert_not_equal(a.__id__, b.__id__)
|
||||||
assert_equal(a.frozen?, b.frozen?)
|
assert_equal(a.frozen?, b.frozen?)
|
||||||
assert_equal(a.untrusted?, b.untrusted?)
|
assert_equal(a.tainted?, b.tainted?)
|
||||||
assert_equal(a.tainted?, b.tainted?)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -756,10 +752,8 @@ class TestArray < Test::Unit::TestCase
|
||||||
|
|
||||||
a6 = @cls[[1, 2], 3]
|
a6 = @cls[[1, 2], 3]
|
||||||
a6.taint
|
a6.taint
|
||||||
a6.untrust
|
|
||||||
a7 = a6.flatten
|
a7 = a6.flatten
|
||||||
assert_equal(true, a7.tainted?)
|
assert_equal(true, a7.tainted?)
|
||||||
assert_equal(true, a7.untrusted?)
|
|
||||||
|
|
||||||
a8 = @cls[[1, 2], 3]
|
a8 = @cls[[1, 2], 3]
|
||||||
a9 = a8.flatten(0)
|
a9 = a8.flatten(0)
|
||||||
|
@ -950,23 +944,18 @@ class TestArray < Test::Unit::TestCase
|
||||||
$, = ""
|
$, = ""
|
||||||
a = @cls[1, 2, 3]
|
a = @cls[1, 2, 3]
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
s = a.join
|
s = a.join
|
||||||
assert_equal(true, s.tainted?)
|
assert_equal(true, s.tainted?)
|
||||||
assert_equal(true, s.untrusted?)
|
|
||||||
|
|
||||||
bug5902 = '[ruby-core:42161]'
|
bug5902 = '[ruby-core:42161]'
|
||||||
sep = ":".taint.untrust
|
sep = ":".taint
|
||||||
|
|
||||||
s = @cls[].join(sep)
|
s = @cls[].join(sep)
|
||||||
assert_equal(false, s.tainted?, bug5902)
|
assert_equal(false, s.tainted?, bug5902)
|
||||||
assert_equal(false, s.untrusted?, bug5902)
|
|
||||||
s = @cls[1].join(sep)
|
s = @cls[1].join(sep)
|
||||||
assert_equal(false, s.tainted?, bug5902)
|
assert_equal(false, s.tainted?, bug5902)
|
||||||
assert_equal(false, s.untrusted?, bug5902)
|
|
||||||
s = @cls[1, 2].join(sep)
|
s = @cls[1, 2].join(sep)
|
||||||
assert_equal(true, s.tainted?, bug5902)
|
assert_equal(true, s.tainted?, bug5902)
|
||||||
assert_equal(true, s.untrusted?, bug5902)
|
|
||||||
|
|
||||||
e = ''.force_encoding('EUC-JP')
|
e = ''.force_encoding('EUC-JP')
|
||||||
u = ''.force_encoding('UTF-8')
|
u = ''.force_encoding('UTF-8')
|
||||||
|
@ -2170,10 +2159,8 @@ class TestArray < Test::Unit::TestCase
|
||||||
def test_inspect
|
def test_inspect
|
||||||
a = @cls[1, 2, 3]
|
a = @cls[1, 2, 3]
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
s = a.inspect
|
s = a.inspect
|
||||||
assert_equal(true, s.tainted?)
|
assert_equal(true, s.tainted?)
|
||||||
assert_equal(true, s.untrusted?)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_initialize2
|
def test_initialize2
|
||||||
|
|
|
@ -226,20 +226,16 @@ class TestHash < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_clone
|
def test_clone
|
||||||
for taint in [ false, true ]
|
for taint in [ false, true ]
|
||||||
for untrust in [ false, true ]
|
for frozen in [ false, true ]
|
||||||
for frozen in [ false, true ]
|
a = @h.clone
|
||||||
a = @h.clone
|
a.taint if taint
|
||||||
a.taint if taint
|
a.freeze if frozen
|
||||||
a.untrust if untrust
|
b = a.clone
|
||||||
a.freeze if frozen
|
|
||||||
b = a.clone
|
|
||||||
|
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
assert_not_same(a, b)
|
assert_not_same(a, b)
|
||||||
assert_equal(a.frozen?, b.frozen?)
|
assert_equal(a.frozen?, b.frozen?)
|
||||||
assert_equal(a.untrusted?, b.untrusted?)
|
assert_equal(a.tainted?, b.tainted?)
|
||||||
assert_equal(a.tainted?, b.tainted?)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -319,19 +315,16 @@ class TestHash < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_dup
|
def test_dup
|
||||||
for taint in [ false, true ]
|
for taint in [ false, true ]
|
||||||
for untrust in [ false, true ]
|
for frozen in [ false, true ]
|
||||||
for frozen in [ false, true ]
|
a = @h.dup
|
||||||
a = @h.dup
|
a.taint if taint
|
||||||
a.taint if taint
|
a.freeze if frozen
|
||||||
a.freeze if frozen
|
b = a.dup
|
||||||
b = a.dup
|
|
||||||
|
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
assert_not_same(a, b)
|
assert_not_same(a, b)
|
||||||
assert_equal(false, b.frozen?)
|
assert_equal(false, b.frozen?)
|
||||||
assert_equal(a.tainted?, b.tainted?)
|
assert_equal(a.tainted?, b.tainted?)
|
||||||
assert_equal(a.untrusted?, b.untrusted?)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -651,10 +644,8 @@ class TestHash < Test::Unit::TestCase
|
||||||
|
|
||||||
h = @cls[ 1=>2, 3=>4, 5=>6 ]
|
h = @cls[ 1=>2, 3=>4, 5=>6 ]
|
||||||
h.taint
|
h.taint
|
||||||
h.untrust
|
|
||||||
a = h.to_a
|
a = h.to_a
|
||||||
assert_equal(true, a.tainted?)
|
assert_equal(true, a.tainted?)
|
||||||
assert_equal(true, a.untrusted?)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_hash
|
def test_to_hash
|
||||||
|
|
|
@ -1486,8 +1486,6 @@ class TestM17N < Test::Unit::TestCase
|
||||||
assert_equal(Encoding::ASCII_8BIT, s.b.encoding)
|
assert_equal(Encoding::ASCII_8BIT, s.b.encoding)
|
||||||
s.taint
|
s.taint
|
||||||
assert_equal(true, s.b.tainted?)
|
assert_equal(true, s.b.tainted?)
|
||||||
s.untrust
|
|
||||||
assert_equal(true, s.b.untrusted?)
|
|
||||||
s = "abc".b
|
s = "abc".b
|
||||||
assert_equal(true, s.b.ascii_only?)
|
assert_equal(true, s.b.ascii_only?)
|
||||||
end
|
end
|
||||||
|
|
|
@ -187,80 +187,55 @@ class TestMarshal < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_taint_and_untrust
|
def test_taint
|
||||||
x = Object.new
|
x = Object.new
|
||||||
x.taint
|
x.taint
|
||||||
x.untrust
|
|
||||||
s = Marshal.dump(x)
|
s = Marshal.dump(x)
|
||||||
assert_equal(true, s.tainted?)
|
assert_equal(true, s.tainted?)
|
||||||
assert_equal(true, s.untrusted?)
|
|
||||||
y = Marshal.load(s)
|
y = Marshal.load(s)
|
||||||
assert_equal(true, y.tainted?)
|
assert_equal(true, y.tainted?)
|
||||||
assert_equal(true, y.untrusted?)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_taint_and_untrust_each_object
|
def test_taint_each_object
|
||||||
x = Object.new
|
x = Object.new
|
||||||
obj = [[x]]
|
obj = [[x]]
|
||||||
|
|
||||||
# clean object causes crean stream
|
# clean object causes crean stream
|
||||||
assert_equal(false, obj.tainted?)
|
assert_equal(false, obj.tainted?)
|
||||||
assert_equal(false, obj.untrusted?)
|
|
||||||
assert_equal(false, obj.first.tainted?)
|
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.tainted?)
|
||||||
assert_equal(false, obj.first.first.untrusted?)
|
|
||||||
s = Marshal.dump(obj)
|
s = Marshal.dump(obj)
|
||||||
assert_equal(false, s.tainted?)
|
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.taint
|
||||||
x.untrust
|
|
||||||
assert_equal(false, obj.tainted?)
|
assert_equal(false, obj.tainted?)
|
||||||
assert_equal(false, obj.untrusted?)
|
|
||||||
assert_equal(false, obj.first.tainted?)
|
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.tainted?)
|
||||||
assert_equal(true, obj.first.first.untrusted?)
|
|
||||||
t = Marshal.dump(obj)
|
t = Marshal.dump(obj)
|
||||||
assert_equal(true, t.tainted?)
|
assert_equal(true, t.tainted?)
|
||||||
assert_equal(true, t.untrusted?)
|
|
||||||
|
|
||||||
# clean stream causes clean objects
|
# clean stream causes clean objects
|
||||||
assert_equal(false, s.tainted?)
|
assert_equal(false, s.tainted?)
|
||||||
assert_equal(false, s.untrusted?)
|
|
||||||
y = Marshal.load(s)
|
y = Marshal.load(s)
|
||||||
assert_equal(false, y.tainted?)
|
assert_equal(false, y.tainted?)
|
||||||
assert_equal(false, y.untrusted?)
|
|
||||||
assert_equal(false, y.first.tainted?)
|
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.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.tainted?)
|
||||||
assert_equal(true, t.untrusted?)
|
|
||||||
y = Marshal.load(t)
|
y = Marshal.load(t)
|
||||||
assert_equal(true, y.tainted?)
|
assert_equal(true, y.tainted?)
|
||||||
assert_equal(true, y.untrusted?)
|
|
||||||
assert_equal(true, y.first.tainted?)
|
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.tainted?)
|
||||||
assert_equal(true, y.first.first.untrusted?)
|
|
||||||
|
|
||||||
# same tests by different senario
|
# same tests by different senario
|
||||||
s.taint
|
s.taint
|
||||||
s.untrust
|
|
||||||
assert_equal(true, s.tainted?)
|
assert_equal(true, s.tainted?)
|
||||||
assert_equal(true, s.untrusted?)
|
|
||||||
y = Marshal.load(s)
|
y = Marshal.load(s)
|
||||||
assert_equal(true, y.tainted?)
|
assert_equal(true, y.tainted?)
|
||||||
assert_equal(true, y.untrusted?)
|
|
||||||
assert_equal(true, y.first.tainted?)
|
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.tainted?)
|
||||||
assert_equal(true, y.first.first.untrusted?)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_symbol2
|
def test_symbol2
|
||||||
|
@ -511,11 +486,9 @@ class TestMarshal < Test::Unit::TestCase
|
||||||
bug7325 = '[ruby-core:49198]'
|
bug7325 = '[ruby-core:49198]'
|
||||||
for c in [TestClass, TestModule]
|
for c in [TestClass, TestModule]
|
||||||
assert(!c.tainted?)
|
assert(!c.tainted?)
|
||||||
assert(!c.untrusted?)
|
c2 = Marshal.load(Marshal.dump(c).taint)
|
||||||
c2 = Marshal.load(Marshal.dump(c).taint.untrust)
|
|
||||||
assert_same(c, c2)
|
assert_same(c, c2)
|
||||||
assert(!c.tainted?, bug7325)
|
assert(!c.tainted?, bug7325)
|
||||||
assert(!c.untrusted?, bug7325)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -652,29 +652,33 @@ class TestObject < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_untrusted
|
def test_untrusted
|
||||||
obj = Object.new
|
verbose = $VERBOSE
|
||||||
assert_equal(false, obj.untrusted?)
|
$VERBOSE = false
|
||||||
assert_equal(false, obj.tainted?)
|
begin
|
||||||
obj.untrust
|
obj = Object.new
|
||||||
assert_equal(true, obj.untrusted?)
|
assert_equal(false, obj.untrusted?)
|
||||||
assert_equal(true, obj.tainted?)
|
assert_equal(false, obj.tainted?)
|
||||||
obj.trust
|
obj.untrust
|
||||||
assert_equal(false, obj.untrusted?)
|
assert_equal(true, obj.untrusted?)
|
||||||
assert_equal(false, obj.tainted?)
|
assert_equal(true, obj.tainted?)
|
||||||
obj.taint
|
obj.trust
|
||||||
assert_equal(true, obj.untrusted?)
|
assert_equal(false, obj.untrusted?)
|
||||||
assert_equal(true, obj.tainted?)
|
assert_equal(false, obj.tainted?)
|
||||||
obj.untaint
|
obj.taint
|
||||||
assert_equal(false, obj.untrusted?)
|
assert_equal(true, obj.untrusted?)
|
||||||
assert_equal(false, obj.tainted?)
|
assert_equal(true, obj.tainted?)
|
||||||
|
obj.untaint
|
||||||
|
assert_equal(false, obj.untrusted?)
|
||||||
|
assert_equal(false, obj.tainted?)
|
||||||
|
ensure
|
||||||
|
$VERBOSE = verbose
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s
|
def test_to_s
|
||||||
x = Object.new
|
x = Object.new
|
||||||
x.taint
|
x.taint
|
||||||
x.untrust
|
|
||||||
s = x.to_s
|
s = x.to_s
|
||||||
assert_equal(true, s.untrusted?)
|
|
||||||
assert_equal(true, s.tainted?)
|
assert_equal(true, s.tainted?)
|
||||||
|
|
||||||
x = eval(<<-EOS)
|
x = eval(<<-EOS)
|
||||||
|
|
|
@ -451,20 +451,16 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_clone
|
def test_clone
|
||||||
for taint in [ false, true ]
|
for taint in [ false, true ]
|
||||||
for untrust in [ false, true ]
|
for frozen in [ false, true ]
|
||||||
for frozen in [ false, true ]
|
a = S("Cool")
|
||||||
a = S("Cool")
|
a.taint if taint
|
||||||
a.taint if taint
|
a.freeze if frozen
|
||||||
a.untrust if untrust
|
b = a.clone
|
||||||
a.freeze if frozen
|
|
||||||
b = a.clone
|
|
||||||
|
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
assert(a.__id__ != b.__id__)
|
assert(a.__id__ != b.__id__)
|
||||||
assert_equal(a.frozen?, b.frozen?)
|
assert_equal(a.frozen?, b.frozen?)
|
||||||
assert_equal(a.untrusted?, b.untrusted?)
|
assert_equal(a.tainted?, b.tainted?)
|
||||||
assert_equal(a.tainted?, b.tainted?)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -588,20 +584,16 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_dup
|
def test_dup
|
||||||
for taint in [ false, true ]
|
for taint in [ false, true ]
|
||||||
for untrust in [ false, true ]
|
for frozen in [ false, true ]
|
||||||
for frozen in [ false, true ]
|
a = S("hello")
|
||||||
a = S("hello")
|
a.taint if taint
|
||||||
a.taint if taint
|
a.freeze if frozen
|
||||||
a.untrust if untrust
|
b = a.dup
|
||||||
a.freeze if frozen
|
|
||||||
b = a.dup
|
|
||||||
|
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
assert(a.__id__ != b.__id__)
|
assert(a.__id__ != b.__id__)
|
||||||
assert(!b.frozen?)
|
assert(!b.frozen?)
|
||||||
assert_equal(a.tainted?, b.tainted?)
|
assert_equal(a.tainted?, b.tainted?)
|
||||||
assert_equal(a.untrusted?, b.untrusted?)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -817,9 +809,7 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
a = S("hello")
|
a = S("hello")
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
assert(a.gsub(/./, S('X')).tainted?)
|
assert(a.gsub(/./, S('X')).tainted?)
|
||||||
assert(a.gsub(/./, S('X')).untrusted?)
|
|
||||||
|
|
||||||
assert_equal("z", "abc".gsub(/./, "a" => "z"), "moved from btest/knownbug")
|
assert_equal("z", "abc".gsub(/./, "a" => "z"), "moved from btest/knownbug")
|
||||||
|
|
||||||
|
@ -862,10 +852,8 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
r = S('X')
|
r = S('X')
|
||||||
r.taint
|
r.taint
|
||||||
r.untrust
|
|
||||||
a.gsub!(/./, r)
|
a.gsub!(/./, r)
|
||||||
assert(a.tainted?)
|
assert(a.tainted?)
|
||||||
assert(a.untrusted?)
|
|
||||||
|
|
||||||
a = S("hello")
|
a = S("hello")
|
||||||
assert_nil(a.sub!(S('X'), S('Y')))
|
assert_nil(a.sub!(S('X'), S('Y')))
|
||||||
|
@ -1054,11 +1042,9 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
a = S("foo")
|
a = S("foo")
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
b = a.replace(S("xyz"))
|
b = a.replace(S("xyz"))
|
||||||
assert_equal(S("xyz"), b)
|
assert_equal(S("xyz"), b)
|
||||||
assert(b.tainted?)
|
assert(b.tainted?)
|
||||||
assert(b.untrusted?)
|
|
||||||
|
|
||||||
s = "foo" * 100
|
s = "foo" * 100
|
||||||
s2 = ("bar" * 100).dup
|
s2 = ("bar" * 100).dup
|
||||||
|
@ -1152,11 +1138,9 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
a = S("hello")
|
a = S("hello")
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
res = []
|
res = []
|
||||||
a.scan(/./) { |w| res << w }
|
a.scan(/./) { |w| res << w }
|
||||||
assert(res[0].tainted?, '[ruby-core:33338] #4087')
|
assert(res[0].tainted?, '[ruby-core:33338] #4087')
|
||||||
assert(res[0].untrusted?, '[ruby-core:33338] #4087')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_size
|
def test_size
|
||||||
|
@ -1439,10 +1423,8 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
a = S("hello")
|
a = S("hello")
|
||||||
a.taint
|
a.taint
|
||||||
a.untrust
|
|
||||||
x = a.sub(/./, S('X'))
|
x = a.sub(/./, S('X'))
|
||||||
assert(x.tainted?)
|
assert(x.tainted?)
|
||||||
assert(x.untrusted?)
|
|
||||||
|
|
||||||
o = Object.new
|
o = Object.new
|
||||||
def o.to_str; "bar"; end
|
def o.to_str; "bar"; end
|
||||||
|
@ -1483,10 +1465,8 @@ class TestString < Test::Unit::TestCase
|
||||||
|
|
||||||
r = S('X')
|
r = S('X')
|
||||||
r.taint
|
r.taint
|
||||||
r.untrust
|
|
||||||
a.sub!(/./, r)
|
a.sub!(/./, r)
|
||||||
assert(a.tainted?)
|
assert(a.tainted?)
|
||||||
assert(a.untrusted?)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_succ
|
def test_succ
|
||||||
|
|
Loading…
Add table
Reference in a new issue