Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Failing spec for String#tr. #1872

wants to merge 1 commit into from

6 participants


"hello".tr("helo", "1212").should == "12112" but incorrectly results in "122222". The pull request contains a more comprehensive example.

Please also see #1871 for a more in-depth description of the problem.


This pull request fails (merged ccc968e into af9f288).


You forgot to tag it :)



More precisely bin/mspec tag spec/ruby/core/string/tr_spec.rb


There is actually already a failing spec that we have tagged that exposes the same issue. We don't want to create duplicate specs / add more complex specs if we only really need a simple case to cover the behavior.

I'm actually looking at fixing the already existing specs, to fix the bug we talked about.


I'm fine with this not getting pulled. So, @dbussink you will fix? Then I'll close this and do not fix?


@jc00ke Thanks for the link!

I'm closing this one.

@floere floere closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 20, 2012
  1. @floere
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 spec/ruby/core/string/tr_spec.rb
4 spec/ruby/core/string/tr_spec.rb
@@ -7,6 +7,10 @@
"hello".tr('aeiou', '*').should == "h*ll*"
"hello".tr('el', 'ip').should == "hippo"
"Lisp".tr("Lisp", "Ruby").should == "Ruby"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".tr(
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
+ "2223334445556667777888999922233344455566677778889999"
+ ).should == "2223334445556667777888999922233344455566677778889999"
it "accepts c1-c2 notation to denote ranges of characters" do
Something went wrong with that request. Please try again.