diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-04-30 00:54:47 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-29 16:55:37 +0000 |
commit | c2871161b453b37b444a759ebec6260c2c0fd0a4 (patch) | |
tree | 7da29d8cd111756c72e2be709b61a882ec549456 /test | |
parent | 85a9fd1902e2eba7910aa7490a8f09560dff451f (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')
-rw-r--r-- | test/rdoc/test_rdoc_comment.rb | 9 |
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 |