Skip to content

Commit

Permalink
Fix #equal? for numeric, boolean and strings. Add Kernel#equal? specs
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 29, 2013
1 parent 5352a03 commit ab65e84
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions corelib/boolean.rb
Expand Up @@ -21,6 +21,8 @@ def ==(other)
`(self == true) === other.valueOf()`
end

alias equal? ==

alias singleton_class class

def to_s
Expand Down
1 change: 1 addition & 0 deletions corelib/numeric.rb
Expand Up @@ -267,6 +267,7 @@ def downto(finish, &block)
end

alias eql? ==
alias equal? ==

def even?
`self % 2 === 0`
Expand Down
2 changes: 2 additions & 0 deletions spec/filters/bugs/kernel.rb
Expand Up @@ -7,4 +7,6 @@
fails "Kernel#<=> returns 0 if self is == to the argument"
fails "Kernel#<=> returns nil if self is eql? but not == to the argument"
fails "Kernel#<=> returns nil if self.==(arg) returns nil"

fails "Kernel#equal? returns true only if obj and other are the same object"
end
12 changes: 0 additions & 12 deletions spec/rubyspec/core/kernel/equal_spec.rb

This file was deleted.

1 change: 1 addition & 0 deletions spec/rubyspecs
Expand Up @@ -194,6 +194,7 @@ core/hash/values_spec

core/kernel/comparison_spec
core/kernel/eql_spec
core/kernel/equal_spec

core/matchdata/to_a_spec

Expand Down

0 comments on commit ab65e84

Please sign in to comment.