Kernel.sprintf with argument of some non-standard type doesn't invoke to_int on 
it
----------------------------------------------------------------------------------

                 Key: JRUBY-1738
                 URL: http://jira.codehaus.org/browse/JRUBY-1738
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: JRuby 1.1b1 from trunk
            Reporter: Vladimir Sizikov
         Attachments: kernel-sprintf-handling-nonstandard-types.patch

Consider the following:

{noformat}
obj = Object.new
def obj.to_int() 4 end

puts sprintf('%d', obj)
{noformat}

Ruby 1.8.6, Rubinius, Ruby 1.9 return:
4

JRuby:
can't convert #<Class:01x4c47db> into Integer (TypeError)

This leads to numerous Rubinius spec failures for String.

The proposed patch fixes the problem, and adds a unit test.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to