Adding new key to a Hash during iteration should always raise an exception
--------------------------------------------------------------------------

                 Key: JRUBY-4565
                 URL: http://jira.codehaus.org/browse/JRUBY-4565
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules, RubySpec
    Affects Versions: JRuby 1.4
            Reporter: Vladimir Sizikov


New RubySpec enforces this:

{noformat}
commit 2ae272118ce7e0068d5087cd321a8aa551ced581
Author: Yusuke Endoh <[email protected]>
Date:   Wed Feb 17 01:29:16 2010 +0900

    adding new key into hash during iteration always raises an exception

    matz agreed.  [ruby-core:23614]
{noformat}

{noformat}
jruby -S mspec ci core\hash
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-02-16 2770c7f) (Java 
HotSpot(TM) Client VM 1.6.0_18) [x86-java]
...............F....................F.........F........

1)
Hash#[]= raises RuntimeErrors if attempt to add new key during iteration FAILED
Expected RuntimeError but no exception was raised
D:/work/jruby-dev/rubyspec.git/core/hash/shared/store.rb:56
D:/work/jruby-dev/rubyspec.git/core/hash/element_set_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/hash/element_set_spec.rb:56:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-ci:8

2)
Hash#merge! raises RuntimeErrors if attempt to add new key during iteration 
FAILED
Expected RuntimeError but no exception was raised
D:/work/jruby-dev/rubyspec.git/core/hash/merge_spec.rb:66
D:/work/jruby-dev/rubyspec.git/core/hash/merge_spec.rb:58
D:/work/jruby-dev/rubyspec.git/core/hash/merge_spec.rb:56:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-ci:8

3)
Hash#store raises RuntimeErrors if attempt to add new key during iteration 
FAILED
Expected RuntimeError but no exception was raised
D:/work/jruby-dev/rubyspec.git/core/hash/shared/store.rb:56
D:/work/jruby-dev/rubyspec.git/core/hash/store_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/hash/store_spec.rb:56:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-ci:8

Finished in 0.781000 seconds
{noformat}

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