Skip to content
Permalink
Browse files

Merge pull request #636 from kachick/fix-kernel-comparison

Fix Kernel#<=>
  • Loading branch information
alex committed Apr 19, 2013
2 parents cf5d76e + b7615c4 commit 466ff7797e0887594c86b707ca315d2a6c44da93
@@ -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

This file was deleted.

@@ -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 = []
@@ -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:

0 comments on commit 466ff77

Please sign in to comment.
You can’t perform that action at this time.