summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-11-02 08:58:21 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-11-02 08:58:21 +0900
commitf2084f300ba87ff6e42437a52aebb5e7a6c19355 (patch)
treeaaa552eeb4fb61d0edca679a2f33f623cb4967c2 /mrbgems
parent8e596956259353ddf3ff0370028a758d9ce435d8 (diff)
downloadmruby-f2084f300ba87ff6e42437a52aebb5e7a6c19355.tar.gz
mruby-f2084f300ba87ff6e42437a52aebb5e7a6c19355.zip
Add tests for empty patterns for `tr` and `count`; #4156 #4157
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/mruby-string-ext/test/string.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb
index 36a253989..f0f8be6b3 100644
--- a/mrbgems/mruby-string-ext/test/string.rb
+++ b/mrbgems/mruby-string-ext/test/string.rb
@@ -149,6 +149,7 @@ end
assert('String#count') do
s = "abccdeff123"
+ assert_equal 0, s.count("")
assert_equal 1, s.count("a")
assert_equal 2, s.count("ab")
assert_equal 9, s.count("^c")
@@ -161,6 +162,7 @@ assert('String#tr') do
assert_equal "hippo", "hello".tr('el', 'ip')
assert_equal "Ruby", "Lisp".tr("Lisp", "Ruby")
assert_equal "*e**o", "hello".tr('^aeiou', '*')
+ assert_equal "heo", "hello".tr('l', '')
end
assert('String#tr!') do