diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-18 09:52:55 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-18 09:52:55 +0000 |
commit | 5d67a0d0dfbc8a417e0e64ef7e5a58fa881e2c12 (patch) | |
tree | 6b1ac1e40d8300e852f0e9e632df08f0dfdfa1c0 /test/ruby | |
parent | 7c3a8ebdc42e78a96f2ffc6c3c2740b3291d1b0a (diff) | |
download | ruby-5d67a0d0dfbc8a417e0e64ef7e5a58fa881e2c12.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/ruby')
-rw-r--r-- | test/ruby/test_string.rb | 5 |
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 |