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

parent 8e596956
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment