diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/irb/test_history.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index 15c16ed897..021bb682c1 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -488,6 +488,36 @@ module TestIRB HISTORY end + def test_direct_debug_session_loads_history + @envs['RUBY_DEBUG_IRB_CONSOLE'] = "1" + write_history <<~HISTORY + old_history_1 + old_history_2 + old_history_3 + HISTORY + + write_ruby <<~'RUBY' + require 'debug' + debugger + binding.irb # needed to satisfy run_ruby_file + RUBY + + output = run_ruby_file do + type "history" + type "puts 'foo'" + type "history" + type "exit!" + end + + assert_include(output, "irb:rdbg(main):002") # assert that we're in an irb:rdbg session + assert_include(output, "5: history") + assert_include(output, "4: puts 'foo'") + assert_include(output, "3: history") + assert_include(output, "2: old_history_3") + assert_include(output, "1: old_history_2") + assert_include(output, "0: old_history_1") + end + private def write_history(history) |
