Add tests for empty patterns for tr and count; #4156 #4157

This commit is contained in:
Yukihiro "Matz" Matsumoto
2018-11-02 08:58:21 +09:00
parent 8e59695625
commit f2084f300b
+2
View File
@@ -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