Skip to content

Commit

Permalink
Add accidentally dropped disable_irb command back (#964)
Browse files Browse the repository at this point in the history
* Add accidentally dropped disable_irb command back

* Sort command files require by name
  • Loading branch information
st0012 authored Jun 5, 2024
1 parent a572180 commit 1d627ce
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
37 changes: 21 additions & 16 deletions lib/irb/default_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -235,6 +236,10 @@ def load_command(command)
[:history, NO_OVERRIDE],
[:hist, NO_OVERRIDE]
)

_register_with_aliases(:irb_disable_irb, Command::DisableIrb,
[:disable_irb, NO_OVERRIDE]
)
end

ExtendCommand = Command
Expand Down
28 changes: 28 additions & 0 deletions test/irb/command/test_disable_irb.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1d627ce

Please sign in to comment.