Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #636 from kachick/fix-kernel-comparison
Fix Kernel#<=>
  • Loading branch information
alex committed Apr 19, 2013
2 parents cf5d76e + b7615c4 commit 466ff77
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
4 changes: 4 additions & 0 deletions lib-topaz/kernel.rb
Expand Up @@ -15,6 +15,10 @@ def p(*args)
args.each { |arg| $stdout.print(arg.inspect + "\n") }
end

def <=>(other)
self == other ? 0 : nil
end

def Array(arg)
if arg.respond_to? :to_ary
arg.to_ary
Expand Down
2 changes: 0 additions & 2 deletions spec/tags/core/kernel/comparison_tags.txt

This file was deleted.

8 changes: 0 additions & 8 deletions tests/objects/test_objectobject.py
Expand Up @@ -298,14 +298,6 @@ class C < B
""")
assert self.unwrap(space, w_res) == [False, True, False]

def test_cmp(self, space):
w_res = space.execute("""
a = Object.new
b = Object.new
return a <=> a, a <=> b
""")
assert self.unwrap(space, w_res) == [0, None]

def test_extend(self, space):
w_res = space.execute("""
$res = []
Expand Down
7 changes: 0 additions & 7 deletions topaz/objects/objectobject.py
Expand Up @@ -138,13 +138,6 @@ def method_inspect(self, space):
def method_to_s(self, space):
return space.newstr_fromstr(space.any_to_s(self))

@classdef.method("<=>")
def method_cmp(self, space, w_other):
if w_other is self:
return space.newint(0)
else:
return space.w_nil

@classdef.method("===")
def method_eqeqeq(self, space, w_other):
if self is w_other:
Expand Down

0 comments on commit 466ff77

Please sign in to comment.