@@ -783,19 +783,33 @@ def test_ls_with_no_singleton_class
783783 end
784784
785785 class ShowDocTest < CommandTestCase
786- def test_help_and_show_doc
787- [ "help" , "show_doc" ] . each do |cmd |
788- out , err = execute_lines (
789- "#{ cmd } String#gsub\n " ,
790- "\n " ,
791- )
786+ def test_help
787+ out , err = execute_lines (
788+ "help String#gsub\n " ,
789+ "\n " ,
790+ )
792791
793- # the former is what we'd get without document content installed, like on CI
794- # the latter is what we may get locally
795- possible_rdoc_output = [ /Nothing known about String#gsub/ , /gsub\( pattern\) / ]
796- assert_empty err
797- assert ( possible_rdoc_output . any? { |output | output . match? ( out ) } , "Expect the `#{ cmd } ` command to match one of the possible outputs. Got:\n #{ out } " )
798- end
792+ # the former is what we'd get without document content installed, like on CI
793+ # the latter is what we may get locally
794+ possible_rdoc_output = [ /Nothing known about String#gsub/ , /gsub\( pattern\) / ]
795+ assert_include err , "[Deprecation] The `help` command will be repurposed to display command help in the future.\n "
796+ assert ( possible_rdoc_output . any? { |output | output . match? ( out ) } , "Expect the `help` command to match one of the possible outputs. Got:\n #{ out } " )
797+ ensure
798+ # this is the only way to reset the redefined method without coupling the test with its implementation
799+ EnvUtil . suppress_warning { load "irb/cmd/help.rb" }
800+ end
801+
802+ def test_show_doc
803+ out , err = execute_lines (
804+ "show_doc String#gsub\n " ,
805+ "\n " ,
806+ )
807+
808+ # the former is what we'd get without document content installed, like on CI
809+ # the latter is what we may get locally
810+ possible_rdoc_output = [ /Nothing known about String#gsub/ , /gsub\( pattern\) / ]
811+ assert_not_include err , "[Deprecation]"
812+ assert ( possible_rdoc_output . any? { |output | output . match? ( out ) } , "Expect the `show_doc` command to match one of the possible outputs. Got:\n #{ out } " )
799813 ensure
800814 # this is the only way to reset the redefined method without coupling the test with its implementation
801815 EnvUtil . suppress_warning { load "irb/cmd/help.rb" }
0 commit comments