summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb60
1 files changed, 20 insertions, 40 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 651ab7c90c6..9db3d2cb0fe 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -451,20 +451,16 @@ class TestString < Test::Unit::TestCase
def test_clone
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = S("Cool")
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.clone
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert_equal(a.frozen?, b.frozen?)
- assert_equal(a.untrusted?, b.untrusted?)
- assert_equal(a.tainted?, b.tainted?)
- end
+ for frozen in [ false, true ]
+ a = S("Cool")
+ a.taint if taint
+ a.freeze if frozen
+ b = a.clone
+
+ assert_equal(a, b)
+ assert(a.__id__ != b.__id__)
+ assert_equal(a.frozen?, b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
@@ -588,20 +584,16 @@ class TestString < Test::Unit::TestCase
def test_dup
for taint in [ false, true ]
- for untrust in [ false, true ]
- for frozen in [ false, true ]
- a = S("hello")
- a.taint if taint
- a.untrust if untrust
- a.freeze if frozen
- b = a.dup
-
- assert_equal(a, b)
- assert(a.__id__ != b.__id__)
- assert(!b.frozen?)
- assert_equal(a.tainted?, b.tainted?)
- assert_equal(a.untrusted?, b.untrusted?)
- end
+ for frozen in [ false, true ]
+ a = S("hello")
+ a.taint if taint
+ a.freeze if frozen
+ b = a.dup
+
+ assert_equal(a, b)
+ assert(a.__id__ != b.__id__)
+ assert(!b.frozen?)
+ assert_equal(a.tainted?, b.tainted?)
end
end
end
@@ -817,9 +809,7 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
assert(a.gsub(/./, S('X')).tainted?)
- assert(a.gsub(/./, S('X')).untrusted?)
assert_equal("z", "abc".gsub(/./, "a" => "z"), "moved from btest/knownbug")
@@ -862,10 +852,8 @@ class TestString < Test::Unit::TestCase
r = S('X')
r.taint
- r.untrust
a.gsub!(/./, r)
assert(a.tainted?)
- assert(a.untrusted?)
a = S("hello")
assert_nil(a.sub!(S('X'), S('Y')))
@@ -1054,11 +1042,9 @@ class TestString < Test::Unit::TestCase
a = S("foo")
a.taint
- a.untrust
b = a.replace(S("xyz"))
assert_equal(S("xyz"), b)
assert(b.tainted?)
- assert(b.untrusted?)
s = "foo" * 100
s2 = ("bar" * 100).dup
@@ -1152,11 +1138,9 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
res = []
a.scan(/./) { |w| res << w }
assert(res[0].tainted?, '[ruby-core:33338] #4087')
- assert(res[0].untrusted?, '[ruby-core:33338] #4087')
end
def test_size
@@ -1439,10 +1423,8 @@ class TestString < Test::Unit::TestCase
a = S("hello")
a.taint
- a.untrust
x = a.sub(/./, S('X'))
assert(x.tainted?)
- assert(x.untrusted?)
o = Object.new
def o.to_str; "bar"; end
@@ -1483,10 +1465,8 @@ class TestString < Test::Unit::TestCase
r = S('X')
r.taint
- r.untrust
a.sub!(/./, r)
assert(a.tainted?)
- assert(a.untrusted?)
end
def test_succ