From 805899dda29e36a42ffd9e076b9296f3bf13af5a Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Mon, 24 Apr 2023 15:05:11 +0100 Subject: [ruby/irb] Filter out top-level methods when using `ls ` (https://github.com/ruby/irb/pull/562) Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `` is specified to be either of those. --- test/irb/test_cmd.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 66328b89b1..5cbc5b4663 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -697,6 +697,8 @@ module TestIRB assert_empty err assert_match(/C2.methods:\s+m3\s+m5\n/, out) assert_match(/C2#methods:\s+m3\s+m4\n.*M1#methods:\s+m2\n.*C1#methods:\s+m1\n/, out) + assert_not_match(/Module#methods/, out) + assert_not_match(/Class#methods/, out) end def test_ls_module @@ -716,8 +718,9 @@ module TestIRB ) assert_empty err - assert_match(/M2\.methods:\s+m4\nModule#methods:/, out) + assert_match(/M2\.methods:\s+m4\n/, out) assert_match(/M2#methods:\s+m1\s+m3\n.*M1#methods:\s+m2\n/, out) + assert_not_match(/Module#methods/, out) end def test_ls_instance -- cgit v1.2.1