[MacRuby-devel] [MacRuby] #784: Exception is generated when change Hash's key.

MacRuby ruby-noreply at macosforge.org
Mon Jul 12 18:10:22 PDT 2010


#784: Exception is generated when change Hash's key.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 It seems that this issue blocks #753

 Test Script:
 {{{
 $ cat test_hash.rb
 # based on send_header() in "lib/webrick/httpresponse.rb"
 hash = {}
 hash["content-type"] = "text/html"

 hash.each{|key,value|
   p "#{key} : #{value}"
   tmp = key.gsub(/\bwww|^te$|\b\w/){
     p $&
     p $&.upcase
   }
   p tmp
 }
 }}}

 Result of Ruby 1.9.1:
 {{{
 $ ruby test_hash.rb
 "content-type : text/html"
 "c"
 "C"
 "t"
 "T"
 "Content-Type"
 }}}

 Result of MacRuby Trunk:
 {{{
 $ macruby test_hash.rb
 "content-type : text/html"
 "c"
 "C"
 /Users/watson/test/ruby/macruby/test_hash.rb:6:in `block': string frozen
 (RuntimeError)
         from /Users/watson/test/ruby/macruby/test_hash.rb:5:in `<main>'
 }}}


 Test Script works when changed "key.gsub" to "key.dup.gsub".

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/784>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list