1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test
Jeremy Evans 58325daae3 Make String methods return String instances when called on a subclass instance
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]
2020-11-20 16:30:23 -08:00
..
-ext- Make String methods return String instances when called on a subclass instance 2020-11-20 16:30:23 -08:00
base64
benchmark
bigdecimal
cgi
coverage
csv
date
dbm
did_you_mean Revert "Fixed typo" 2020-10-27 23:26:38 +09:00
digest
drb
dtrace
erb Fixup 3292f4d965 2020-08-21 20:40:26 +09:00
etc
excludes
fiber Fix TestFiberMutex#test_condition_variable assertion 2020-11-08 16:49:33 +01:00
fiddle [ruby/fiddle] test: suppress shadowing outer local variable warning 2020-11-18 09:05:13 +09:00
fileutils Make the test suite pass on real Android/Termux environment 2020-10-12 21:26:05 +09:00
gdbm
io [ruby/io-console] Fix timeout type error (#18) 2020-10-11 02:00:24 +09:00
irb Update expected IRB result 2020-11-20 18:30:05 +09:00
json test/json/json_parser_test.rb: suppress warnings 2020-10-21 23:37:42 +09:00
lib
logger
matrix
mkmf
monitor
net test/net/smtp - use TCPSocket when UNIXSocket unavailable 2020-11-18 08:13:10 +09:00
nkf
objspace Fix ObjectSpace.dump(obj, output: :stdout) 2020-10-03 00:00:01 +09:00
open-uri Remove the deprecated override of Kernel#open in open-uri 2020-08-16 07:41:40 -07:00
openssl Revert the related commits about Tempfile.open change. 2020-09-09 21:10:48 +09:00
optparse
ostruct [lib/ostruct] Fix Marshal loading 2020-10-06 17:11:08 -04:00
pathname Make the test suite pass on real Android/Termux environment 2020-10-12 21:26:05 +09:00
psych [ruby/psych] Forward keyword arguments in load_file and load_stream 2020-09-25 13:11:33 +09:00
racc [ruby/racc] skip the failing test with JRuby 2020-11-10 21:21:07 +09:00
rdoc [ruby/rdoc] update all files if any file is newer 2020-09-18 14:57:58 +09:00
readline
reline [ruby/reline] Treat prompt correctly when Reline.prompt_proc isn't set 2020-09-12 08:35:52 +09:00
resolv fe80 should be case insensitive too 2020-11-09 16:16:30 +09:00
rinda Revert "test/rinda/test_rinda.rb: try debugging TestRingServer#test_do_reply" 2020-10-17 15:32:40 +09:00
ripper Ripper.{lex,tokenize} return full tokens even if syntax error 2020-11-20 11:44:57 +09:00
ruby Make String methods return String instances when called on a subclass instance 2020-11-20 16:30:23 -08:00
rubygems Merge rubygems-3.2.0.rc.2 2020-10-15 14:12:02 +09:00
socket Add resolve_timeout to TCPSocket [Feature #17134] 2020-09-25 15:19:14 +09:00
stringio [stringio] fix stringio codepoint enumerator off by one error 2020-08-27 23:41:22 +09:00
strscan
syslog
uri
webrick [ruby/webrick] Allow empty POST and PUT requests without content length 2020-11-13 11:35:10 +09:00
win32ole
yaml
zlib [ruby/zlib] Add Zlib::GzipReader.zcat for handling multiple gzip streams in gz file 2020-09-14 17:52:20 +09:00
runner.rb
test_abbrev.rb
test_delegate.rb
test_extlibs.rb Removed win32api 2020-11-11 09:27:36 +09:00
test_find.rb
test_forwardable.rb
test_ipaddr.rb
test_mutex_m.rb
test_observer.rb
test_open3.rb
test_pp.rb
test_prettyprint.rb
test_prime.rb
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb Use build_message on test_securerandom.rb (#3543) 2020-09-16 07:45:01 +09:00
test_set.rb
test_shellwords.rb
test_singleton.rb
test_syslog.rb
test_tempfile.rb
test_time.rb
test_timeout.rb
test_tmpdir.rb [ruby/tmpdir] Warn when environment variables skipped (fixes #2) 2020-09-14 18:22:37 +09:00
test_tracer.rb
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb