Rubyspec failure for Enumerator#next
------------------------------------

                 Key: JRUBY-4010
                 URL: http://jira.codehaus.org/browse/JRUBY-4010
             Project: JRuby
          Issue Type: Bug
          Components: RubySpec
    Affects Versions: JRuby 1.3.1
         Environment: jruby 1.4.0dev (ruby 1.8.7 patchlevel 174) (2009-09-27 
704b415) (Java HotSpot(TM) Client VM 1.6.0_03) [i386-java]
            Reporter: Vladimir Sizikov


Due to changes in rubyspec test, we now have one more JRuby failure:

{noformat}
#>mspec/bin/mspec -t j ruby/library/enumerator/next_spec.rb
jruby 1.4.0dev (ruby 1.8.7 patchlevel 174) (2009-09-27 704b415) (Java 
HotSpot(TM) Client VM 1.6.0_03) [i386-java]
..F

1)
Enumerator#next cannot be called again until the enumerator is rewound FAILED
Expected StopIteration but no exception was raised
/opt/work/jruby.git/spec/ruby/shared/enumerator/next.rb:23
/opt/work/jruby.git/spec/ruby/library/enumerator/next_spec.rb:7
/opt/work/jruby.git/spec/ruby/library/enumerator/next_spec.rb:3
/opt/work/jruby.git/spec/ruby/library/enumerator/next_spec.rb:55:in `load'

Finished in 0.092000 seconds

1 file, 3 examples, 6 expectations, 1 failure, 0 errors

{noformat}

The strange  thing is that MRI 1.8.7 also fails this very same test. But MRI 
1.9 doesn't. The change was introduced in rubyspecs in 
07c8e9cf11a7fe356dbc54275a353bb89753b2fb:

{noformat}
-  it "rewinds the enumerator after raising StopIteration" do
+  it "cannot be called again until the enumerator is rewound" do
     3.times { @enum.next }
     lambda { @enum.next }.should raise_error(StopIteration)
+    lambda { @enum.next }.should raise_error(StopIteration)
+    lambda { @enum.next }.should raise_error(StopIteration)
+    @enum.rewind
     @enum.next.should == 1
   end
 end
{noformat}

This change directly contradicts the ruby-doc:
When the position reached at the end, internal position is rewinded then 
StopIteration is raised. 

Need to clarify with rubyspec/mri folks.



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