Skip to content

Commit 5d67967

Browse files
authored
Fix Reline's test failure running with make test-all TESTS='reline irb' (#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"`
1 parent 5669efa commit 5d67967

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

test/irb/test_context.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_eval_input_raise2x
9191
end
9292

9393
def test_prompt_n_deprecation
94-
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new))
94+
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), TestInputMethod.new)
9595

9696
_, err = capture_output do
9797
irb.context.prompt_n = "foo"

test/irb/test_input_method.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def setup
1515
def teardown
1616
IRB.conf.replace(@conf_backup)
1717
restore_encodings
18+
# Reset Reline configuration overrided by RelineInputMethod.
19+
Reline.instance_variable_set(:@core, nil)
1820
end
1921

2022
def test_initialization

test/irb/test_irb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def build_irb
738738
workspace = IRB::WorkSpace.new(TOPLEVEL_BINDING.dup)
739739

740740
IRB.conf[:VERBOSE] = false
741-
IRB::Irb.new(workspace)
741+
IRB::Irb.new(workspace, TestInputMethod.new)
742742
end
743743
end
744744
end

test/irb/test_ruby_lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def build_context(local_variables = nil)
222222
end
223223

224224
IRB.conf[:VERBOSE] = false
225-
IRB::Context.new(nil, workspace)
225+
IRB::Context.new(nil, workspace, TestInputMethod.new)
226226
end
227227

228228
def assert_indent_level(lines, expected, local_variables: [])

0 commit comments

Comments
 (0)