summaryrefslogtreecommitdiff
path: root/test/-ext-/string/test_ellipsize.rb
AgeCommit message (Collapse)Author
2020-11-20Make String methods return String instances when called on a subclass instanceJeremy Evans
This modifies the following String methods to return String instances instead of subclass instances: * String#* * String#capitalize * String#center * String#chomp * String#chop * String#delete * String#delete_prefix * String#delete_suffix * String#downcase * String#dump * String#each/#each_line * String#gsub * String#ljust * String#lstrip * String#partition * String#reverse * String#rjust * String#rpartition * String#rstrip * String#scrub * String#slice! * String#slice/#[] * String#split * String#squeeze * String#strip * String#sub * String#succ/#next * String#swapcase * String#tr * String#tr_s * String#upcase This also fixes a bug in String#swapcase where it would return the receiver instead of a copy of the receiver if the receiver was the empty string. Some string methods were left to return subclass instances: * String#+@ * String#-@ Both of these methods will return the receiver (subclass instance) in some cases, so it is best to keep the returned class consistent. Fixes [#10845] Notes: Merged: https://github.com/ruby/ruby/pull/3701
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15-test-/string: movenobu
* ext/-test-/string/extconf.rb: move "-test-/string/string.so" to "-test-/string.so". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14test/-ext-: suppress warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24encdb.c, encoding.c: make BOM-encodings dummynobu
* enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy. * encoding.c (enc_autoload): keep dummy encodings dummy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24string/test_ellipsize.rb: remove non-sense testsnobu
* test/-ext-/string/test_ellipsize.rb (Test_StringEllipsize#test_nonascii): rb_str_ellipsize() does not support BOM. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30* string.c (rb_str_ellipsize): new function to ellipsize a string.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e