summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_comment.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-04-30 00:54:47 +0900
committergit <svn-admin@ruby-lang.org>2023-04-29 16:55:37 +0000
commitc2871161b453b37b444a759ebec6260c2c0fd0a4 (patch)
tree7da29d8cd111756c72e2be709b61a882ec549456 /test/rdoc/test_rdoc_comment.rb
parent85a9fd1902e2eba7910aa7490a8f09560dff451f (diff)
[ruby/rdoc] Fix polynominal backtracking
Fix https://github.com/ruby/rdoc/pull/995 https://github.com/ruby/rdoc/commit/1311ca8c50
Diffstat (limited to 'test/rdoc/test_rdoc_comment.rb')
-rw-r--r--test/rdoc/test_rdoc_comment.rb9
1 files changed, 9 insertions, 0 deletions
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