From c2871161b453b37b444a759ebec6260c2c0fd0a4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 30 Apr 2023 00:54:47 +0900 Subject: [ruby/rdoc] Fix polynominal backtracking Fix https://github.com/ruby/rdoc/pull/995 https://github.com/ruby/rdoc/commit/1311ca8c50 --- test/rdoc/test_rdoc_comment.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/rdoc/test_rdoc_comment.rb b/test/rdoc/test_rdoc_comment.rb index d3c16bceca..28e8cf76b4 100644 --- a/test/rdoc/test_rdoc_comment.rb +++ b/test/rdoc/test_rdoc_comment.rb @@ -206,6 +206,15 @@ lines, one line per element. Lines are assumed to be separated by _sep_. assert_equal expected, comment.text end + def test_extract_call_linear_performance + pre = ->(n) {[n, RDoc::Comment.new("\n"*n + 'call-seq:' + 'a'*n)]} + method_obj = RDoc::AnyMethod.new nil, 'blah' + assert_linear_performance((2..5).map {|i| 10**i}, pre: pre) do |n, comment| + comment.extract_call_seq method_obj + assert_equal n, method_obj.call_seq.size + end + end + def test_force_encoding @comment = RDoc::Encoding.change_encoding @comment, Encoding::UTF_8 -- cgit v1.2.1