Skip to content

Commit 61fa6c8

Browse files
tompng4lllex
andcommitted
Add test for method visibility preserved when merging with existing store cache
Test from #1736. Fixes #346 Co-authored-by: Alex <468442+4lllex@users.noreply.github.com>
1 parent b7a1b84 commit 61fa6c8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎test/rdoc/rdoc_store_test.rb‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,24 @@ def test_save_class_merge_constant
951951
assert_empty result.constants
952952
end
953953

954+
def test_save_class_merge_method_visibility
955+
private_meth = RDoc::AnyMethod.new 'private_method'
956+
private_meth.record_location @top_level
957+
private_meth.visibility = :private
958+
@klass.add_method private_meth
959+
960+
@s.save_class @klass
961+
# Second save loads the class saved above and merges @klass into it
962+
@s.save_class @klass
963+
964+
assert_equal :public, @meth.visibility
965+
assert_equal :private, private_meth.visibility
966+
967+
loaded = @s.load_class 'Object'
968+
assert_equal :public, loaded.find_method('method', false).visibility
969+
assert_equal :private, loaded.find_method('private_method', false).visibility
970+
end
971+
954972
def test_save_class_methods
955973
@s.save_class @klass
956974

0 commit comments

Comments
 (0)