Add spec cases for differences to MRI
@@ -11,6 +11,7 @@ def spec
string_reverse
string_tr
string_end_with
+ string_to_i
true
end
@@ -198,4 +199,12 @@ def string_end_with
'abc'.end_with?('e', 'bc', /c/)
end
+def string_to_i
+ # All POSIX whitespace should get trimmed
+ raise unless "\x0B\n\r\t\x0C 123".to_i == 123
+
+ # Only single underscores are valid
+ raise unless '1__23'.to_i == 1
+end
+
spec if $PROGRAM_NAME == __FILE__
