Skip to content

Commit ab65e84

Browse files
committedOct 29, 2013
Fix #equal? for numeric, boolean and strings. Add Kernel#equal? specs
1 parent 5352a03 commit ab65e84

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed
 

‎corelib/boolean.rb

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def ==(other)
2121
`(self == true) === other.valueOf()`
2222
end
2323

24+
alias equal? ==
25+
2426
alias singleton_class class
2527

2628
def to_s

‎corelib/numeric.rb

+1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def downto(finish, &block)
267267
end
268268

269269
alias eql? ==
270+
alias equal? ==
270271

271272
def even?
272273
`self % 2 === 0`

‎spec/filters/bugs/kernel.rb

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
fails "Kernel#<=> returns 0 if self is == to the argument"
88
fails "Kernel#<=> returns nil if self is eql? but not == to the argument"
99
fails "Kernel#<=> returns nil if self.==(arg) returns nil"
10+
11+
fails "Kernel#equal? returns true only if obj and other are the same object"
1012
end

‎spec/rubyspec/core/kernel/equal_spec.rb

-12
This file was deleted.

‎spec/rubyspecs

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ core/hash/values_spec
194194

195195
core/kernel/comparison_spec
196196
core/kernel/eql_spec
197+
core/kernel/equal_spec
197198

198199
core/matchdata/to_a_spec
199200

0 commit comments

Comments
 (0)
Please sign in to comment.