From c9e28ea2f9d442f5efd2a2671ff81cd4308dcde2 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Sun, 1 Oct 2023 02:56:00 +0900 Subject: [PATCH] [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 --- test/irb/test_context.rb | 2 +- test/irb/test_input_method.rb | 2 ++ test/irb/test_irb.rb | 2 +- test/irb/test_ruby_lex.rb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index f59a23a99d..34bceea54f 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -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" diff --git a/test/irb/test_input_method.rb b/test/irb/test_input_method.rb index ea7efb5dd5..b516be5e3c 100644 --- a/test/irb/test_input_method.rb +++ b/test/irb/test_input_method.rb @@ -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 diff --git a/test/irb/test_irb.rb b/test/irb/test_irb.rb index 0c77bb0f76..4e5a94b1be 100644 --- a/test/irb/test_irb.rb +++ b/test/irb/test_irb.rb @@ -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 diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb index 09344e1b0e..b9e55c7330 100644 --- a/test/irb/test_ruby_lex.rb +++ b/test/irb/test_ruby_lex.rb @@ -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: [])