diff options
author | Stan Lo <stan001212@gmail.com> | 2023-04-24 15:05:11 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-24 14:05:16 +0000 |
commit | 805899dda29e36a42ffd9e076b9296f3bf13af5a (patch) | |
tree | edc70d418bd1419b25d1018e038b58d178bf6883 /test | |
parent | 886986b3efe157148e329957c7f236f0e35be0c2 (diff) |
[ruby/irb] Filter out top-level methods when using `ls
<Class/Module>`
(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 `<Class/Module>` is specified to be
either of those.
Diffstat (limited to 'test')
-rw-r--r-- | test/irb/test_cmd.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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 |