summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-08-29 19:08:15 +0100
committergit <svn-admin@ruby-lang.org>2023-08-29 18:36:16 +0000
commitf37f357e808a7435f56946cd603a333feba7691b (patch)
tree19b6c5c33b5883898e28df0f5df0cd155c0ae658 /test
parentc58561b5e3f597867a6e62f451a77ea27a6b9150 (diff)
[ruby/irb] Improve help/show_cmds message during debugger
integration (https://github.com/ruby/irb/pull/693) * `help` should display debugger's help during irb:rdbg session * Update `show_cmds`'s output when in irb:rdbg session https://github.com/ruby/irb/commit/4029c2e564
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_debug_cmd.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/irb/test_debug_cmd.rb b/test/irb/test_debug_cmd.rb
index a99f7a943f..d669c174e6 100644
--- a/test/irb/test_debug_cmd.rb
+++ b/test/irb/test_debug_cmd.rb
@@ -331,6 +331,39 @@ module TestIRB
assert_include(output, "InputMethod: RelineInputMethod")
end
+ def test_help_command_is_delegated_to_the_debugger
+ write_ruby <<~'ruby'
+ binding.irb
+ ruby
+
+ output = run_ruby_file do
+ type "debug"
+ type "help"
+ type "continue"
+ end
+
+ assert_include(output, "### Frame control")
+ end
+
+ def test_show_cmds_display_different_content_when_debugger_is_enabled
+ write_ruby <<~'ruby'
+ # disable pager
+ STDIN.singleton_class.define_method(:tty?) { false }
+ binding.irb
+ ruby
+
+ output = run_ruby_file do
+ type "debug"
+ type "show_cmds"
+ type "continue"
+ end
+
+ # IRB's commands should still be listed
+ assert_match(/show_cmds\s+List all available commands and their description\./, output)
+ # debug gem's commands should be appended at the end
+ assert_match(/Debugging \(from debug\.gem\)\s+### Control flow/, output)
+ end
+
def test_input_is_evaluated_in_the_context_of_the_current_thread
write_ruby <<~'ruby'
current_thread = Thread.current