diff options
author | aycabta <[email protected]> | 2021-06-29 20:01:46 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-07-05 11:34:29 +0900 |
commit | caa123b50e12c5ea95763d7661adb6096e48df21 (patch) | |
tree | 9d52cf3f968289d64dd2eb44f23dde4444de18f3 /test | |
parent | 2f3edf28f3a251bac2cf3b47b46b372faac71e8e (diff) |
[ruby/rdoc] Support ActiveSupport::Concern.included
ref. https://github.com/rails/rails/blob/168ddaa08a63cd956bb7c3ba10be1a7ae36d4ee2/activerecord/lib/active_record/core.rb#L9-L20
https://github.com/ruby/rdoc/commit/a2d651dade
Co-authored-by: Fumiaki MATSUSHIMA <[email protected]>
Diffstat (limited to 'test')
-rw-r--r-- | test/rdoc/test_rdoc_parser_ruby.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index 0c81906090..337cf9ea1a 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -4297,4 +4297,52 @@ end assert_equal 'A::D', a_d.full_name end + def test_parse_included + util_parser <<-CLASS +module A + module B + extend ActiveSupport::Concern + included do + ## + # :singleton-method: + # Hello + mattr_accessor :foo + end + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_module_named 'B' + assert_equal 'A::B', a_b.full_name + meth = a_b.method_list.first + assert_equal 'foo', meth.name + assert_equal 'Hello', meth.comment.text + end + + def test_end_that_doesnt_belong_to_class_doesnt_change_visibility + util_parser <<-CLASS +class A + private + + begin + end + + # Hello + def foo() end +end + CLASS + + @parser.scan + + a = @store.find_class_named 'A' + assert_equal 'A', a.full_name + assert_equal 'foo', a.find_method_named('foo').name + meth = a.method_list.first + assert_equal 'Hello', meth.comment.text + end + end |