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 @@ -3287,6 +3287,33 @@ def b() end
3287
3287
assert c_b . singleton
3288
3288
end
3289
3289
3290
+ def test_scan_visibility_count
3291
+ util_parser <<-RUBY
3292
+ class C < Original::Base
3293
+ class C2 < Original::Base
3294
+ def m0() end
3295
+ def m1() end
3296
+
3297
+ private
3298
+
3299
+ def m2() end
3300
+ def m3() end
3301
+ def m4() end
3302
+ end
3303
+ end
3304
+ RUBY
3305
+
3306
+ @parser . scan
3307
+
3308
+ c = @store . find_class_named 'C::C2'
3309
+
3310
+ private_method_count = c . method_list . count { |m | :private == m . visibility }
3311
+ assert_equal 3 , private_method_count
3312
+
3313
+ public_method_count = c . method_list . count { |m | :public == m . visibility }
3314
+ assert_equal 2 , public_method_count
3315
+ end
3316
+
3290
3317
def test_singleton_method_via_eigenclass
3291
3318
util_parser <<-RUBY
3292
3319
class C
You can’t perform that action at this time.
0 commit comments