-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #equal? should test for object identity, not whether the contents are equal, as per the Ruby documentation. * #eql? and #== should check the contents directly instead of comparing the hash. This prevents false positives.
- Loading branch information
1 parent
08a213b
commit f2b4474
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,23 @@ def test_assert_hosts_hash_equally | |
def test_assert_hosts_compare_equal | ||
assert Host.new('example.com') == Host.new('example.com') | ||
assert Host.new('example.com').eql? Host.new('example.com') | ||
assert Host.new('example.com').equal? Host.new('example.com') | ||
|
||
assert Host.new('example.com:22') == Host.new('example.com') | ||
assert Host.new('example.com:22').eql? Host.new('example.com') | ||
|
||
assert Host.new('example.com:22') != Host.new('example.com:23') | ||
assert !Host.new('example.com:22').eql?(Host.new('example.com:23')) | ||
|
||
assert Host.new('[email protected]') == Host.new('[email protected]') | ||
assert Host.new('[email protected]').eql? Host.new('[email protected]') | ||
|
||
assert Host.new('[email protected]') != Host.new('[email protected]') | ||
assert !Host.new('[email protected]').eql?(Host.new('[email protected]')) | ||
|
||
a = Host.new('example.com') | ||
b = Host.new('example.com') | ||
assert a.equal? a | ||
assert !a.equal?(b) | ||
end | ||
|
||
def test_arbitrary_host_properties | ||
|