Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Remove 1.8 behaviour in Rubinius' String#include?
  • Loading branch information
chrisseaton committed Jan 5, 2015
1 parent 6e85813 commit fe45893
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Expand Up @@ -29,14 +29,7 @@
class String

def include?(needle)
if needle.kind_of? Fixnum
needle = needle % 256
str_needle = needle.chr
else
str_needle = StringValue(needle)
end

!!find_string(str_needle, 0)
!!find_string(StringValue(needle), 0)
end

end
1 change: 1 addition & 0 deletions spec/ruby/core/string/include_spec.rb
Expand Up @@ -22,6 +22,7 @@

it "raises a TypeError if other can't be converted to string" do
lambda { "hello".include?([]) }.should raise_error(TypeError)
lambda { "hello".include?('h'.ord) }.should raise_error(TypeError)
lambda { "hello".include?(mock('x')) }.should raise_error(TypeError)
end
end

0 comments on commit fe45893

Please sign in to comment.