File tree Expand file tree Collapse file tree 2 files changed +14
-31
lines changed Expand file tree Collapse file tree 2 files changed +14
-31
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require_relative "show_doc "
3
+ require_relative "show_cmds "
4
4
5
5
module IRB
6
6
module ExtendCommand
7
- class Help < ShowDoc
8
- category "Context"
9
- description "[DEPRECATED] Enter the mode to look up RI documents."
10
-
11
- DEPRECATION_MESSAGE = <<~MSG
12
- [Deprecation] The `help` command will be repurposed to display command help in the future.
13
- For RI document lookup, please use the `show_doc` command instead.
14
- For command help, please use `show_cmds` for now.
15
- MSG
16
-
17
- def execute ( *names )
18
- warn DEPRECATION_MESSAGE
19
- super
20
- end
7
+ class Help < ShowCmds
8
+ category "IRB"
9
+ description "List all available commands and their description."
21
10
end
22
11
end
23
12
end
Original file line number Diff line number Diff line change @@ -603,6 +603,16 @@ def test_whereami_alias
603
603
604
604
605
605
class ShowCmdsTest < CommandTestCase
606
+ def test_help
607
+ out , err = execute_lines (
608
+ "help\n " ,
609
+ )
610
+
611
+ assert_empty err
612
+ assert_match ( /List all available commands and their description/ , out )
613
+ assert_match ( /Start the debugger of debug\. gem/ , out )
614
+ end
615
+
606
616
def test_show_cmds
607
617
out , err = execute_lines (
608
618
"show_cmds\n "
@@ -774,22 +784,6 @@ def test_ls_with_no_singleton_class
774
784
end
775
785
776
786
class ShowDocTest < CommandTestCase
777
- def test_help
778
- out , err = execute_lines (
779
- "help String#gsub\n " ,
780
- "\n " ,
781
- )
782
-
783
- # the former is what we'd get without document content installed, like on CI
784
- # the latter is what we may get locally
785
- possible_rdoc_output = [ /Nothing known about String#gsub/ , /gsub\( pattern\) / ]
786
- assert_include err , "[Deprecation] The `help` command will be repurposed to display command help in the future.\n "
787
- assert ( possible_rdoc_output . any? { |output | output . match? ( out ) } , "Expect the `help` command to match one of the possible outputs. Got:\n #{ out } " )
788
- ensure
789
- # this is the only way to reset the redefined method without coupling the test with its implementation
790
- EnvUtil . suppress_warning { load "irb/cmd/help.rb" }
791
- end
792
-
793
787
def test_show_doc
794
788
out , err = execute_lines (
795
789
"show_doc String#gsub\n " ,
You can’t perform that action at this time.
0 commit comments