[ruby-dev:39108] [Bug #1953] empty range in String#tr causes unexpected behavior

View: New views
2 Messages — Rating Filter:   Alert me  

[ruby-dev:39108] [Bug #1953] empty range in String#tr causes unexpected behavior

by Roger Pack-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bug #1953: empty range in String#tr causes unexpected behavior
http://redmine.ruby-lang.org/issues/show/1953

起票者: Yusuke Endoh
ステータス: Open, 優先度: Normal
Target version: 1.9.x
ruby -v: ruby 1.9.2dev (2009-08-18 trunk 24578) [i686-linux

Are these intentional?

  "ABC".tr("ABC", "pq-a")    #=> "pqq"
  "ABC".tr("ABC", "pq-ar")   #=> "prr"
  "ABC".tr("ABC", "pq-ars")  #=> "prs"
  "ABC".tr("ABC", "pq-arst") #=> "prs"

I expect that an exception is raised or that "p-a" equals to
"ponmlk...cba" (descending order).

For reference, empty range is rejected in Perl:

  $ perl -e '"A" =~ tr/A/q-a/;'
  Invalid range "q-a" in transliteration operator at -e line 1.

--
Yusuke ENDOH <mame@...>


----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39590] [Bug #1953](Closed) empty range in String#tr causes unexpected behavior

by Roger Pack-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #1953 が更新されました。 (by Yukihiro Matsumoto)

ステータス AssignedからClosedに変更
進捗 % 0から100に変更

This issue was solved with changeset r25576.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

----------------------------------------
http://redmine.ruby-lang.org/issues/show/1953

----------------------------------------
http://redmine.ruby-lang.org