From 013515f29b776070a2953ab736b5e7522c201d31 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Tue, 18 Jul 2017 09:33:38 +0900 Subject: [PATCH] Add test_parse_method_bracket --- test/test_rdoc_parser_ruby.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 0db7707458..f61450af93 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1650,6 +1650,28 @@ def test_parse_method assert_equal stream, foo.token_stream end + def test_parse_method_bracket + util_parser <<-RUBY +class C + def [] end + def self.[] end + def []= end + def self.[]= end +end + RUBY + + @parser.scan + + c = @store.find_class_named 'C' + + assert_equal 4, c.method_list.size + assert_equal 'C#[]', c.method_list[0].full_name + assert_equal 'C::[]', c.method_list[1].full_name + assert_equal 'C#[]=', c.method_list[2].full_name + assert_equal 'C::[]=', c.method_list[3].full_name + assert c.aliases.empty? + end + def test_parse_method_alias klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level