[MacRuby-devel] [MacRuby] #752: description -> to_s infinite loop
MacRuby
ruby-noreply at macosforge.org
Fri Jun 18 16:37:12 PDT 2010
#752: description -> to_s infinite loop
--------------------------------------+-------------------------------------
Reporter: ryand-ruby@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
--------------------------------------+-------------------------------------
I had a failing unit test that was causing an infinite stack trace. The
code in question was:
{{{
class SimpleNodeData
attr_accessor :name, :path, :image, :expandable, :selectable, :container
def initialize name = "Untitled", path = nil
self.name = name
self.path = path
self.expandable = true
self.selectable = true
self.container = true
end
def compare other
if SimpleNodeData === other
return name.compare other.name
end
return NSOrderedAscending
end
alias :<=> :compare
def description
"%@ - '%@' expandable: %@, selectable: %@, container: %@" %
[super, name, expandable, selectable, container]
end
alias :to_s :description
end
}}}
That last alias is the real problem... comment it out and everything works
fine.
I believe the failing test line was:
{{{
assert child.representedObject.path,
child.representedObject.description
}}}
and the representedObject was a SimpleNodeData instance.
--
Ticket URL: <http://www.macruby.org/trac/ticket/752>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list