summaryrefslogtreecommitdiff
path: root/test/-ext-/string/test_too_many_dummy_encodings.rb
blob: b96b40db7b73aed6456f452ec12b2af8eaecd063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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([], "#{<<~"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