From: ts Date: 2008-04-24T19:36:28+09:00 Subject: Re: Action Item: RubySpec failures on Ruby 1.8.7 Vladimir Sizikov wrote: Well I've a problem with some tests, for example > 45) IO#each_byte raises IOError on closed stream FAILED > Expected IOError but no exception was raised it work as expected if you write it like this vgs% ./ruby -ve 'a = File.open("ruby") {|f| f}; a.each_byte {}' ruby 1.8.7 (2008-04-23 patchlevel 5000) [i686-linux] -e:1:in `each_byte': closed stream (IOError) from -e:1 vgs% but with vgs% ./ruby -ve 'a = File.open("ruby") {|f| f}; b = a.each_byte; p b; b.next' ruby 1.8.7 (2008-04-23 patchlevel 5000) [i686-linux] # /home/ts/local/r18/lib/ruby/1.8/generator.rb:188: warning: method redefined; discarding old next /home/ts/local/r18/lib/ruby/1.8/generator.rb:200: warning: method redefined; discarding old rewind /home/ts/local/r18/lib/ruby/1.8/generator.rb:72:in `each_byte': closed stream (IOError) from /home/ts/local/r18/lib/ruby/1.8/generator.rb:72:in `each' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:72:in `initialize' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:83:in `call' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:83:in `initialize' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:170:in `new' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:170:in `__generator' from /home/ts/local/r18/lib/ruby/1.8/generator.rb:189:in `next' from -e:1 vgs% ruby give an error but only when you call #next *not* when it return an Enumerator object. Guy Decoux