diff options
author | Benoit Daloze <eregontp@gmail.com> | 2023-01-06 15:07:39 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2023-01-11 13:41:41 +0100 |
commit | 6abe20e87b74a5a672dc59f72fa1f550ceab430c (patch) | |
tree | 85ea11a007e23327cfd83e0fb3f29f92767b8ee3 /test/ruby/test_encoding.rb | |
parent | d831b1d5cef23593c94d80240b836fd2038aa685 (diff) | |
download | ruby-6abe20e87b74a5a672dc59f72fa1f550ceab430c.tar.gz |
Remove Encoding#replicate
Diffstat (limited to 'test/ruby/test_encoding.rb')
-rw-r--r-- | test/ruby/test_encoding.rb | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb index cde2951413..e1a5ac4a5f 100644 --- a/test/ruby/test_encoding.rb +++ b/test/ruby/test_encoding.rb @@ -55,40 +55,6 @@ class TestEncoding < Test::Unit::TestCase assert_raise(TypeError, bug5150) {Encoding.find(1)} end - def test_replicate - assert_separately([], "#{<<~'END;'}") - Warning[:deprecated] = false - assert_instance_of(Encoding, Encoding::UTF_8.replicate("UTF-8-ANOTHER#{Time.now.to_f}")) - assert_instance_of(Encoding, Encoding::ISO_2022_JP.replicate("ISO-2022-JP-ANOTHER#{Time.now.to_f}")) - bug3127 = '[ruby-dev:40954]' - assert_raise(TypeError, bug3127) {Encoding::UTF_8.replicate(0)} - assert_raise_with_message(ArgumentError, /\bNUL\b/, bug3127) {Encoding::UTF_8.replicate("\0")} - END; - end - - def test_extra_encoding - assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") - begin; - 100.times {|i| - EnvUtil.suppress_warning { Encoding::UTF_8.replicate("dummy#{i}") } - } - e = Encoding.list.last - format = "%d".force_encoding(e) - assert_equal("0", format % 0) - assert_equal(e, format.dup.encoding) - assert_equal(e, (format*1).encoding) - - assert_equal(e, (("x"*30).force_encoding(e)*1).encoding) - GC.start - - name = "A" * 64 - Encoding.list.each do |enc| - assert_raise(ArgumentError) { EnvUtil.suppress_warning { enc.replicate(name) } } - name.succ! - end - end; - end - def test_dummy_p assert_equal(true, Encoding::ISO_2022_JP.dummy?) assert_equal(false, Encoding::UTF_8.dummy?) @@ -160,18 +126,4 @@ class TestEncoding < Test::Unit::TestCase end end; end - - def test_exceed_encoding_table_size - assert_separately(%w[--disable=gems], "#{<<~"begin;"}\n#{<<~'end;'}") - begin; - begin - enc = Encoding::UTF_8 - 1_000.times{|i| EnvUtil.suppress_warning{ enc.replicate("R_#{i}") } } # now 256 entries - rescue EncodingError => e - assert_match(/too many encoding/, e.message) - else - assert false - end - end; - end end |