From 50471e78a4c108be3d0b694146d2136d8591a677 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 13 Jun 2024 11:40:02 -0400 Subject: [PATCH] Add test coverage for private mixed-in attributes. --- test/rdoc/test_rdoc_class_module.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb index 87d9b276d3..d70a3ea033 100644 --- a/test/rdoc/test_rdoc_class_module.rb +++ b/test/rdoc/test_rdoc_class_module.rb @@ -1525,6 +1525,9 @@ def setup incmod_private_method = @incmod.add_method(RDoc::AnyMethod.new(nil, "incmod_private_method")) incmod_private_method.visibility = :private + incmod_private_attr = @incmod.add_attribute(RDoc::Attr.new(nil, "incmod_private_attr", "RW", "")) + incmod_private_attr.visibility = :private + extmod_tl = @store.add_file("extmod.rb") @extmod = extmod_tl.add_module(RDoc::NormalModule, "Extmod") @@ -1539,6 +1542,9 @@ def setup extmod_private_method = @extmod.add_method(RDoc::AnyMethod.new(nil, "extmod_private_method")) extmod_private_method.visibility = :private + extmod_private_attr = @extmod.add_attribute(RDoc::Attr.new(nil, "extmod_private_attr", "RW", "", true)) + extmod_private_attr.visibility = :private + @klass.add_include(RDoc::Include.new("Incmod", nil)) @klass.add_extend(RDoc::Include.new("Extmod", nil)) @@ -1577,6 +1583,7 @@ def test_embed_mixin_when_true_embeds_methods_and_constants assert_equal(@incmod, instance_attr.mixin_from) refute(@klass.method_list.find { |m| m.name == "incmod_private_method" }) + refute(@klass.attributes.find { |m| m.name == "incmod_private_attr" }) class_method = @klass.method_list.find { |m| m.name == "extmod_method" } assert(class_method, "class method from extended mixin should be present") @@ -1589,6 +1596,7 @@ def test_embed_mixin_when_true_embeds_methods_and_constants assert_equal(@extmod, class_attr.mixin_from) refute(@klass.method_list.find { |m| m.name == "extmod_private_method" }) + refute(@klass.attributes.find { |m| m.name == "extmod_private_attr" }) # assert that sections are also imported constant_section = @klass.sections.find { |s| s.title == "Incmod const section" }