aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 09:52:55 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 09:52:55 +0000
commit86e266bb60e16c3a4868f6174aa8c4a5c50ff4a5 (patch)
tree6b1ac1e40d8300e852f0e9e632df08f0dfdfa1c0 /test
parent1f67a3900fbd45482ed36ad3b148b321307c1576 (diff)
downloadruby-86e266bb60e16c3a4868f6174aa8c4a5c50ff4a5.tar.gz
string: preserve taint flag with String#-@ (uminus)
* string.c (tainted_fstr_update): move up (rb_fstring): support registering tainted strings (register_fstring_tainted): extract from rb_fstring_existing0 (rb_tainted_fstring_existing): use register_fstring_tainted instead git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 1f21619798..84fa99c2bc 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2749,10 +2749,15 @@ CODE
assert_not_equal(str.object_id, (+str).object_id)
assert_equal(str.object_id, (-str).object_id)
+
+ return unless @cls == String
bar = %w(b a r).join('')
assert_not_predicate bar, :tainted?
assert_not_predicate str, :tainted?
assert_same(str, -bar, "uminus deduplicates [Feature #13077]")
+ bar = %w(b a r).taint.join('')
+ tstr = str.dup.taint
+ assert_same -tstr, -bar
end
def test_ord