aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 07:04:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 07:04:28 +0000
commitd61dfcc7939199e19c2034c422f3473142c6d0a4 (patch)
treef3125b04f1bfb5435d8af3d8017013485f5f41e6 /test/ruby
parentd12569b001fd915734a7f85de20e91a4234e381e (diff)
downloadruby-d61dfcc7939199e19c2034c422f3473142c6d0a4.tar.gz
array.c: no infection by unused separator
* array.c (rb_ary_join): should not infected by separator if it is not used. [ruby-core:42161][Bug #5902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_array.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 16875894ef..a4fda99474 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -920,6 +920,19 @@ class TestArray < Test::Unit::TestCase
assert_equal(true, s.tainted?)
assert_equal(true, s.untrusted?)
+ bug5902 = '[ruby-core:42161]'
+ sep = ":".taint.untrust
+
+ s = @cls[].join(sep)
+ assert_equal(false, s.tainted?, bug5902)
+ assert_equal(false, s.untrusted?, bug5902)
+ s = @cls[1].join(sep)
+ assert_equal(false, s.tainted?, bug5902)
+ assert_equal(false, s.untrusted?, bug5902)
+ s = @cls[1, 2].join(sep)
+ assert_equal(true, s.tainted?, bug5902)
+ assert_equal(true, s.untrusted?, bug5902)
+
e = ''.force_encoding('EUC-JP')
u = ''.force_encoding('UTF-8')
assert_equal(Encoding::US_ASCII, [[]].join.encoding)