@@ -66,16 +66,30 @@ def foobar; end
6666 private def foobaz ; end
6767 end
6868 String . define_method ( :foobarbaz ) { }
69- targets = [ :foobar , :foobaz , :foobarbaz ]
69+ targets = [ :foobar , :foobaz , :foobarbaz , :rand ]
7070 type = ReplTypeCompletor ::Types . type_from_object s
7171 assert_equal [ :foobar , :foobarbaz ] , targets & type . methods
72- assert_equal [ :foobar , :foobaz , :foobarbaz ] , targets & type . all_methods
72+ assert_equal [ :foobar , :foobaz , :foobarbaz , :rand ] , targets & type . all_methods
7373 assert_equal [ :foobarbaz ] , targets & ReplTypeCompletor ::Types ::STRING . methods
74- assert_equal [ :foobarbaz ] , targets & ReplTypeCompletor ::Types ::STRING . all_methods
74+ assert_equal [ :foobarbaz , :rand ] , targets & ReplTypeCompletor ::Types ::STRING . all_methods
7575 ensure
7676 String . remove_method :foobarbaz
7777 end
7878
79+ def test_singleton_type_methods
80+ m = Module . new do
81+ class << self
82+ def foobar ; end
83+ private def foobaz ; end
84+ end
85+ end
86+ type = ReplTypeCompletor ::Types ::SingletonType . new ( m )
87+ assert_include type . methods , :foobar
88+ assert_not_include type . methods , :foobaz
89+ assert_include type . all_methods , :foobaz
90+ assert_include type . all_methods , :rand
91+ end
92+
7993 def test_basic_object_methods
8094 bo = BasicObject . new
8195 def bo . foobar ; end
0 commit comments