summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2019-09-24 20:59:12 -0700
committerJeremy Evans <[email protected]>2019-11-18 01:00:25 +0200
commitffd0820ab317542f8780aac475da590a4bdbc7a8 ()
tree6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /test/ruby/test_array.rb
parentc5c05460ac20abcbc0ed686eb4acf06da7a39a79 (diff)
Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
Notes: Merged: https://.com/ruby/ruby/pull/2476
-rw-r--r--test/ruby/test_array.rb68
1 files changed, 16 insertions, 52 deletions
@@ -556,18 +556,14 @@ class TestArray < Test::Unit::TestCase
end
def test_clone
- for taint in [ false, true ]
- for frozen in [ false, true ]
- a = @cls[*(0..99).to_a]
- a.taint if taint
- a.freeze if frozen
- b = a.clone
-
- assert_equal(a, b)
- assert_not_equal(a.__id__, b.__id__)
- assert_equal(a.frozen?, b.frozen?)
- assert_equal(a.tainted?, b.tainted?)
- end
end
end
@@ -754,18 +750,14 @@ class TestArray < Test::Unit::TestCase
end
def test_dup
- for taint in [ false, true ]
- for frozen in [ false, true ]
- a = @cls[*(0..99).to_a]
- a.taint if taint
- a.freeze if frozen
- b = a.dup
-
- assert_equal(a, b)
- assert_not_equal(a.__id__, b.__id__)
- assert_equal(false, b.frozen?)
- assert_equal(a.tainted?, b.tainted?)
- end
end
end
@@ -865,13 +857,6 @@ class TestArray < Test::Unit::TestCase
assert_raise(TypeError, "[ruby-dev:31197]") { [[]].flatten("") }
end
- def test_flatten_taint
- a6 = @cls[[1, 2], 3]
- a6.taint
- a7 = a6.flatten
- assert_equal(true, a7.tainted?)
- end
-
def test_flatten_level0
a8 = @cls[[1, 2], 3]
a9 = a8.flatten(0)
@@ -1132,20 +1117,6 @@ class TestArray < Test::Unit::TestCase
assert_equal("1,2,3", a.join(','))
$, = ""
- a = @cls[1, 2, 3]
- a.taint
- s = a.join
- assert_equal(true, s.tainted?)
-
- bug5902 = '[ruby-core:42161]'
- sep = ":".taint
-
- s = @cls[].join(sep)
- assert_equal(false, s.tainted?, bug5902)
- s = @cls[1].join(sep)
- assert_equal(false, s.tainted?, bug5902)
- s = @cls[1, 2].join(sep)
- assert_equal(true, s.tainted?, bug5902)
e = ''.force_encoding('EUC-JP')
u = ''.force_encoding('UTF-8')
@@ -2899,13 +2870,6 @@ class TestArray < Test::Unit::TestCase
assert_equal(Array2, Array2[*(1..100)][1..99].class) #not embedded
end
- def test_inspect
- a = @cls[1, 2, 3]
- a.taint
- s = a.inspect
- assert_equal(true, s.tainted?)
- end
-
def test_initialize2
a = [1] * 1000
a.instance_eval { initialize }