[ruby/irb] Fix Reline's test failure running with `make test-all

TESTS='reline irb'`
(https://github.com/ruby/irb/pull/722)

* Specify TestInputMethod in test to avoid RelineInputMethod to be used

* Reset Reline in teardown to avoid test failure of `make test-all TESTS="irb reline"`

https://github.com/ruby/irb/commit/5d67967eb1
This commit is contained in:
tomoya ishida 2023-10-01 02:56:00 +09:00 committed by git
parent 4c8fac0741
commit c9e28ea2f9
4 changed files with 5 additions and 3 deletions

View File

@ -91,7 +91,7 @@ module TestIRB
end
def test_prompt_n_deprecation
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new))
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), TestInputMethod.new)
_, err = capture_output do
irb.context.prompt_n = "foo"

View File

@ -15,6 +15,8 @@ module TestIRB
def teardown
IRB.conf.replace(@conf_backup)
restore_encodings
# Reset Reline configuration overrided by RelineInputMethod.
Reline.instance_variable_set(:@core, nil)
end
def test_initialization

View File

@ -738,7 +738,7 @@ module TestIRB
workspace = IRB::WorkSpace.new(TOPLEVEL_BINDING.dup)
IRB.conf[:VERBOSE] = false
IRB::Irb.new(workspace)
IRB::Irb.new(workspace, TestInputMethod.new)
end
end
end

View File

@ -222,7 +222,7 @@ module TestIRB
end
IRB.conf[:VERBOSE] = false
IRB::Context.new(nil, workspace)
IRB::Context.new(nil, workspace, TestInputMethod.new)
end
def assert_indent_level(lines, expected, local_variables: [])