Skip to content

Commit b06611d

Browse files
authored
Improve debug command tests (#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
1 parent df6907a commit b06611d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

test/irb/test_debug_cmd.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
require "tempfile"
1010
require "tmpdir"
11-
require "envutil"
1211

12+
require_relative "../lib/envutil"
1313
require_relative "helper"
1414

1515
module TestIRB
@@ -210,19 +210,13 @@ def test_catch
210210
def run_ruby_file(&block)
211211
cmd = [EnvUtil.rubybin, "-I", LIB, @ruby_file.to_path]
212212
tmp_dir = Dir.mktmpdir
213-
rc_file = File.open(File.join(tmp_dir, ".irbrc"), "w+")
214-
rc_file.write(<<~RUBY)
215-
IRB.conf[:USE_SINGLELINE] = true
216-
Reline.const_set(:IOGate, Reline::GeneralIO)
217-
RUBY
218-
rc_file.close
219213

220214
@commands = []
221215
lines = []
222216

223217
yield
224218

225-
PTY.spawn(IRB_AND_DEBUGGER_OPTIONS.merge("IRBRC" => rc_file.to_path), *cmd) do |read, write, pid|
219+
PTY.spawn(IRB_AND_DEBUGGER_OPTIONS.merge("TERM" => "dumb"), *cmd) do |read, write, pid|
226220
Timeout.timeout(TIMEOUT_SEC) do
227221
while line = safe_gets(read)
228222
lines << line

0 commit comments

Comments
 (0)