Add functional test for regex arguments to end_with?
@@ -10,6 +10,7 @@ def spec
string_unary_minus
string_reverse
string_tr
+ string_end_with
true
end
@@ -182,4 +183,21 @@ def string_tr
raise unless 'abcd'.tr('a-z', 'xxx') == 'xxxx'
end
+def string_end_with
+ def assert_raise_type_error
+ begin
+ yield
+ rescue TypeError
+ return
+ else
+ raise
+ end
+ end
+
+ assert_raise_type_error { "abc".end_with?(/c/) }
+ assert_raise_type_error { "abc".end_with?('e', 'xyz', /c/) }
+
+ "abc".end_with?('e', 'bc', /c/)
+end
+
spec if $PROGRAM_NAME == __FILE__
