summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-06-12 07:36:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-06-12 07:36:36 +0900
commitbe3e36cb0508713d651026597d7320bc9ce8337a (patch)
tree64b1d9c5a4c1b9938abb74a67baa91a452637924 /test
parentd0401dccc4ea5fe7b1769b1f9f86e7900ebde163 (diff)
parentf1e15b023655bb0c377fada2e26b8361f702d429 (diff)
downloadmruby-be3e36cb0508713d651026597d7320bc9ce8337a.tar.gz
mruby-be3e36cb0508713d651026597d7320bc9ce8337a.zip
Merge pull request #2389 from ksss/str-mem-leaks
Fix memory leaks in String
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