mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
[ruby/irb] Stop using ExtendCommandBundle internally
(https://github.com/ruby/irb/pull/925)
This module was used to extend both commands and helpers when they're not
separated. Now that they are, and we have a Command module, we should move
command-related logic to the Command module and update related references.
This will make the code easier to understand and refactor in the future.
f74ec97236
This commit is contained in:
parent
2b11bcb84e
commit
f16c6ac4fd
6 changed files with 117 additions and 109 deletions
|
@ -213,11 +213,11 @@ module TestIRB
|
|||
class CustomCommandTestCase < CommandTestCase
|
||||
def setup
|
||||
@commands_backup = IRB::Command.commands
|
||||
IRB::ExtendCommandBundle.class_variable_set(:@@command_override_policies, nil)
|
||||
IRB::Command.class_variable_set(:@@command_override_policies, nil)
|
||||
end
|
||||
|
||||
def teardown
|
||||
IRB::ExtendCommandBundle.class_variable_set(:@@command_override_policies, nil)
|
||||
IRB::Command.class_variable_set(:@@command_override_policies, nil)
|
||||
IRB::Command.instance_variable_set(:@commands, @commands_backup)
|
||||
end
|
||||
end
|
||||
|
@ -232,7 +232,7 @@ module TestIRB
|
|||
end
|
||||
|
||||
def test_arg
|
||||
IRB::Command._register_with_aliases(:print_arg, PrintArgCommand, [:pa, IRB::ExtendCommandBundle::OVERRIDE_ALL])
|
||||
IRB::Command._register_with_aliases(:print_arg, PrintArgCommand, [:pa, IRB::Command::OVERRIDE_ALL])
|
||||
out, err = execute_lines("print_arg\n")
|
||||
assert_empty err
|
||||
assert_include(out, 'arg=""')
|
||||
|
@ -265,7 +265,7 @@ module TestIRB
|
|||
end
|
||||
|
||||
def test_def_extend_command
|
||||
IRB::Command._register_with_aliases(:foobar, FooBarCommand, [:fbalias, IRB::ExtendCommandBundle::OVERRIDE_ALL])
|
||||
IRB::ExtendCommandBundle.def_extend_command(:foobar, FooBarCommand, nil, [:fbalias, IRB::Command::OVERRIDE_ALL])
|
||||
out, err = execute_lines("foobar\n")
|
||||
assert_empty err
|
||||
assert_include(out, "FooBar executed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue