Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accidentally dropped disable_irb command back #964

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading