File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -3277,6 +3277,33 @@ def b() end
32773277 assert c_b . singleton
32783278 end
32793279
3280+ def test_scan_visibility_count
3281+ util_parser <<-RUBY
3282+ class C < Original::Base
3283+ class C2 < Original::Base
3284+ def m0() end
3285+ def m1() end
3286+
3287+ private
3288+
3289+ def m2() end
3290+ def m3() end
3291+ def m4() end
3292+ end
3293+ end
3294+ RUBY
3295+
3296+ @parser . scan
3297+
3298+ c = @store . find_class_named 'C::C2'
3299+
3300+ private_method_count = c . method_list . count { |m | :private == m . visibility }
3301+ assert_equal 3 , private_method_count
3302+
3303+ public_method_count = c . method_list . count { |m | :public == m . visibility }
3304+ assert_equal 2 , public_method_count
3305+ end
3306+
32803307 def test_singleton_method_via_eigenclass
32813308 util_parser <<-RUBY
32823309class C
You can’t perform that action at this time.
0 commit comments