diff options
author | Stan Lo <[email protected]> | 2024-06-05 17:29:20 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-06-05 16:29:29 +0000 |
commit | aa61d4237dad54e01c00f8cef4ba7f7cdffb8a80 (patch) | |
tree | f20d3d3728e6cff3b059ef39a87817b5a6d58735 | |
parent | 83f02d42e0a3c39661dc99c049ab9a70ff227d5b (diff) |
[ruby/irb] Add accidentally dropped disable_irb command back
(https://github.com/ruby/irb/pull/964)
* Add accidentally dropped disable_irb command back
* Sort command files require by name
https://github.com/ruby/irb/commit/1d627cebca
-rw-r--r-- | lib/irb/default_commands.rb | 37 | ||||
-rw-r--r-- | test/irb/command/test_disable_irb.rb | 28 |
2 files changed, 49 insertions, 16 deletions
diff --git a/lib/irb/default_commands.rb b/lib/irb/default_commands.rb index 1bbc68efa7..91c6b2d041 100644 --- a/lib/irb/default_commands.rb +++ b/lib/irb/default_commands.rb @@ -2,32 +2,33 @@ require_relative "command" require_relative "command/internal_helpers" -require_relative "command/context" -require_relative "command/exit" -require_relative "command/force_exit" -require_relative "command/chws" -require_relative "command/pushws" -require_relative "command/subirb" -require_relative "command/load" -require_relative "command/debug" -require_relative "command/edit" +require_relative "command/backtrace" require_relative "command/break" require_relative "command/catch" -require_relative "command/next" -require_relative "command/delete" -require_relative "command/step" +require_relative "command/chws" +require_relative "command/context" require_relative "command/continue" +require_relative "command/debug" +require_relative "command/delete" +require_relative "command/disable_irb" +require_relative "command/edit" +require_relative "command/exit" require_relative "command/finish" -require_relative "command/backtrace" -require_relative "command/info" +require_relative "command/force_exit" require_relative "command/help" -require_relative "command/show_doc" +require_relative "command/history" +require_relative "command/info" require_relative "command/irb_info" +require_relative "command/load" require_relative "command/ls" require_relative "command/measure" +require_relative "command/next" +require_relative "command/pushws" +require_relative "command/show_doc" require_relative "command/show_source" +require_relative "command/step" +require_relative "command/subirb" require_relative "command/whereami" -require_relative "command/history" module IRB module Command @@ -235,6 +236,10 @@ module IRB [:history, NO_OVERRIDE], [:hist, NO_OVERRIDE] ) + + _register_with_aliases(:irb_disable_irb, Command::DisableIrb, + [:disable_irb, NO_OVERRIDE] + ) end ExtendCommand = Command diff --git a/test/irb/command/test_disable_irb.rb b/test/irb/command/test_disable_irb.rb new file mode 100644 index 0000000000..14a20043d5 --- /dev/null +++ b/test/irb/command/test_disable_irb.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: false +require 'irb' + +require_relative "../helper" + +module TestIRB + class DisableIRBTest < IntegrationTestCase + def test_disable_irb_disable_further_irb_breakpoints + write_ruby <<~'ruby' + puts "First line" + puts "Second line" + binding.irb + puts "Third line" + binding.irb + puts "Fourth line" + ruby + + output = run_ruby_file do + type "disable_irb" + end + + assert_match(/First line\r\n/, output) + assert_match(/Second line\r\n/, output) + assert_match(/Third line\r\n/, output) + assert_match(/Fourth line\r\n/, output) + end + end +end |