[MacRuby] #856: String#count and #tr are broken, contain escaped '-' or '^' in those arguments.

MacRuby ruby-noreply at macosforge.org
Wed Aug 18 01:45:35 PDT 2010


#856: String#count and #tr are broken, contain escaped '-' or '^' in those
arguments.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 $ cat t.rb
 tmp = "qwerty^\\-"
 p tmp.size           # => 9
 p tmp.count("a-z")   # => 6
 p tmp.count("a\\-z") # => 1
 p tmp.count("^y")    # => 8
 p tmp.count("\\^y")  # => 2
 p tmp.count("y^\\")  # => 3

 p "abcdefghijxyz".tr("a\\-z", 'A Z')   # => "AbcdefghijxyZ"
 p "abcdefghijxyz".tr("a\\-z", 'A\\-Z') # => "AbcdefghijxyZ"
 }}}

 Result:
 {{{
 $ VM_DISABLE_RBO=true DYLD_LIBRARY_PATH=. ./macruby -I./lib t.rb
 9
 6
 8
 8
 3
 3
 "ZZZZZZZZZZZZZ"
 invalid string transliteration (ArgumentError)
 }}}

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



More information about the macruby-tickets mailing list