String#each_byte behaves differently than MRI in some cases
-----------------------------------------------------------

                 Key: JRUBY-1796
                 URL: http://jira.codehaus.org/browse/JRUBY-1796
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: Latest JRuby 1.1b1
            Reporter: Vladimir Sizikov
         Attachments: string-each-byte-insert.patch

Example right out of rubinius specs:

{noformat}
# "keeps iterating from the old position (to new string end) when self changes" 
do
r = ""
s = "hello world"
s.each_byte do |c|
  r << c
  s.insert(0, "<>") if r.size < 3
end
puts r   
{noformat}

In MRI, it prints:
{noformat}
h><>hello world
{noformat}

In JRuby, it prints:
{noformat}
h><>hello w
{noformat}

This leads to rubinius spec failure.

The proposed patch fixes the problem.


-- 
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