#669 √ resolved
Janico Greifenberg

[PATCH] StringIO#each_byte should update the position before each yield

Reported by Janico Greifenberg | July 22nd, 2008 @ 11:22 AM | in 1.0 preview

The existing StringIO#each_byte method does not update the position.

$ bin/mspec spec/ruby/1.8/library/stringio/
rubinius 0.9.0 (ruby 1.8.6 compatible) (b55c3b1fa) (07/22/2008) [i686-pc-linux-gnu]
...........................FE...............................................................................................................................................................................................................................................................................................................................

1)
StringIO#each_byte updates the position before each yield FAILED
Expected [0, 0, 0]
 to equal [1, 2, 3]

            Object#__script__ {} at ./spec/ruby/1.8/library/stringio/shared/each_byte.rb:15
    Kernel(Object)#instance_eval at kernel/core/eval.rb:103
                       Proc#call at kernel/core/proc.rb:76
       Enumerable(Array)#all? {} at kernel/core/enumerable.rb:462
                      Array#each at kernel/core/array.rb:572
          Enumerable(Array)#all? at kernel/core/enumerable.rb:462
                      Array#each at kernel/core/array.rb:572
               Object#__script__ at ./spec/ruby/1.8/library/stringio//each_byte_spec.rb:9
        CompiledMethod#as_script at kernel/core/compiled_method.rb:407
             Compile.single_load at kernel/core/compile.rb:248
         Compile.unified_load {} at kernel/core/compile.rb:161
                      Array#each at kernel/core/array.rb:572
            Compile.unified_load at kernel/core/compile.rb:127
                     Kernel.load at kernel/core/compile.rb:408
    Kernel(Object)#instance_eval at kernel/core/eval.rb:103
                      Array#each at kernel/core/array.rb:572
        CompiledMethod#as_script at kernel/core/compiled_method.rb:407
             Compile.single_load at kernel/core/compile.rb:248
     Compile.load_from_extension at kernel/core/compile.rb:326
               Object#__script__ at kernel/loader.rb:221

[...]

Finished in 2.872917 seconds

55 files, 348 examples, 666 expectations, 1 failure, 1 error

After the patch:

bin/mspec spec/ruby/1.8/library/stringio/
rubinius 0.9.0 (ruby 1.8.6 compatible) (b55c3b1fa) (07/22/2008) [i686-pc-linux-gnu]
............................E...............................................................................................................................................................................................................................................................................................................................

[...]
Finished in 1.305339 seconds

55 files, 348 examples, 666 expectations, 0 failures, 1 error

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags