summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-06-01 21:10:08 +0100
committergit <svn-admin@ruby-lang.org>2023-06-01 20:10:13 +0000
commit2d2893f206b1ff012ac68bddbeb860ca737b765f (patch)
treeeff6d1742f44d8d7844b5b586f5fdd4e06e47072
parent39968112f53fb1f905b924fed557132c6ead601c (diff)
[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
-rw-r--r--test/irb/test_debug_cmd.rb10
1 files changed, 2 insertions, 8 deletions
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