diff options
Diffstat (limited to 'test/rdoc/test_rdoc_parser_ruby.rb')
-rw-r--r-- | test/rdoc/test_rdoc_parser_ruby.rb | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index ef8ad91668..3e2a85ffba 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -1960,10 +1960,10 @@ end def test_parse_method_bracket util_parser <<-RUBY class C - def [] end - def self.[] end - def []= end - def self.[]= end + def []; end + def self.[]; end + def []=; end + def self.[]=; end end RUBY @@ -3065,6 +3065,28 @@ RUBY assert_nil m.params, 'Module parameter not removed' end + def test_parse_statements_nodoc_identifier_alias + klass = @top_level.add_class RDoc::NormalClass, 'Foo' + + util_parser "\nalias :old :new # :nodoc:" + + @parser.parse_statements klass, RDoc::Parser::Ruby::NORMAL, nil + + assert_empty klass.aliases + assert_empty klass.unmatched_alias_lists + end + + def test_parse_statements_nodoc_identifier_alias_method + klass = @top_level.add_class RDoc::NormalClass, 'Foo' + + util_parser "\nalias_method :old :new # :nodoc:" + + @parser.parse_statements klass, RDoc::Parser::Ruby::NORMAL, nil + + assert_empty klass.aliases + assert_empty klass.unmatched_alias_lists + end + def test_parse_statements_stopdoc_alias klass = @top_level.add_class RDoc::NormalClass, 'Foo' @@ -3205,6 +3227,14 @@ RUBY assert_nil @parser.parse_symbol_in_arg end + def test_parse_percent_symbol + content = '%s[foo bar]' + util_parser content + tk = @parser.get_tk + assert_equal :on_symbol, tk[:kind] + assert_equal content, tk[:text] + end + def test_parse_statements_alias_method content = <<-CONTENT class A @@ -3350,6 +3380,13 @@ end assert_equal :on_const, parser.get_tk[:kind] end + def test_read_directive_linear_performance + pre = ->(i) {util_parser '# ' + '0'*i + '=000:'} + assert_linear_performance((1..5).map{|i|10**i}, pre: pre) do |parser| + assert_nil parser.read_directive [] + end + end + def test_read_documentation_modifiers c = RDoc::Context.new |