aboutsummaryrefslogtreecommitdiffstats
path: root/test/-ext-/string
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-01-06 15:07:39 +0100
committerBenoit Daloze <eregontp@gmail.com>2023-01-11 13:41:41 +0100
commit6abe20e87b74a5a672dc59f72fa1f550ceab430c (patch)
tree85ea11a007e23327cfd83e0fb3f29f92767b8ee3 /test/-ext-/string
parentd831b1d5cef23593c94d80240b836fd2038aa685 (diff)
downloadruby-6abe20e87b74a5a672dc59f72fa1f550ceab430c.tar.gz
Remove Encoding#replicate
Diffstat (limited to 'test/-ext-/string')
-rw-r--r--test/-ext-/string/test_too_many_dummy_encodings.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/-ext-/string/test_too_many_dummy_encodings.rb b/test/-ext-/string/test_too_many_dummy_encodings.rb
new file mode 100644
index 0000000000..4d71fd1d72
--- /dev/null
+++ b/test/-ext-/string/test_too_many_dummy_encodings.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: false
+require 'test/unit'
+require "-test-/string"
+
+class Test_TooManyDummyEncodings < Test::Unit::TestCase
+ def test_exceed_encoding_table_size
+ assert_separately(%w[--disable=gems], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ require "-test-/string"
+ assert_raise_with_message(EncodingError, /too many encoding/) do
+ 1_000.times{|i| Bug::String.rb_define_dummy_encoding("R_#{i}") } # now 256 entries
+ end
+ end;
+ end
+end