summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorksss <[email protected]>2014-06-11 14:42:18 +0000
committerksss <[email protected]>2014-06-11 14:42:18 +0000
commitbd53818999f882e7509c797b7a9be4decef42c81 (patch)
tree1f6ce02cedc0778cf55c47f23fc249d621f217e4 /test
parent63be55c77c98cd77b5e2468719b23f5cedca3df8 (diff)
downloadmruby-bd53818999f882e7509c797b7a9be4decef42c81.tar.gz
mruby-bd53818999f882e7509c797b7a9be4decef42c81.zip
str_replace: self should not be shared and nofree
Diffstat (limited to 'test')
-rw-r--r--test/t/string.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/t/string.rb b/test/t/string.rb
index 5ecb51530..00e98f671 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -320,6 +320,13 @@ assert('String#replace', '15.2.10.5.28') do
b.replace(c);
c.replace(b);
assert_equal c, b
+
+ # shared string
+ s = "foo" * 100
+ a = s[10, 90] # create shared string
+ assert_equal("", s.replace("")) # clear
+ assert_equal("", s) # s is cleared
+ assert_not_equal("", a) # a should not be affected
end
assert('String#reverse', '15.2.10.5.29') do