From 2d2893f206b1ff012ac68bddbeb860ca737b765f Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 1 Jun 2023 21:10:08 +0100 Subject: [ruby/irb] Improve debug command tests (https://github.com/ruby/irb/pull/594) * Use require_relative for envutil.rb Requiring test helper files with `require_relative` allows running the tests with `ruby -Itest test/irb/test_debug_cmd.rb` without having to set up the load path. * Replace reline hack with TERM=dumb --- test/irb/test_debug_cmd.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/irb/test_debug_cmd.rb b/test/irb/test_debug_cmd.rb index 80331ea0d4..74a7de38c2 100644 --- a/test/irb/test_debug_cmd.rb +++ b/test/irb/test_debug_cmd.rb @@ -8,8 +8,8 @@ end require "tempfile" require "tmpdir" -require "envutil" +require_relative "../lib/envutil" require_relative "helper" module TestIRB @@ -210,19 +210,13 @@ module TestIRB def run_ruby_file(&block) cmd = [EnvUtil.rubybin, "-I", LIB, @ruby_file.to_path] tmp_dir = Dir.mktmpdir - rc_file = File.open(File.join(tmp_dir, ".irbrc"), "w+") - rc_file.write(<<~RUBY) - IRB.conf[:USE_SINGLELINE] = true - Reline.const_set(:IOGate, Reline::GeneralIO) - RUBY - rc_file.close @commands = [] lines = [] yield - PTY.spawn(IRB_AND_DEBUGGER_OPTIONS.merge("IRBRC" => rc_file.to_path), *cmd) do |read, write, pid| + PTY.spawn(IRB_AND_DEBUGGER_OPTIONS.merge("TERM" => "dumb"), *cmd) do |read, write, pid| Timeout.timeout(TIMEOUT_SEC) do while line = safe_gets(read) lines << line -- cgit v1.2.3