[ruby/irb] Store integration tests' envs in an ivar

(https://github.com/ruby/irb/pull/668)

https://github.com/ruby/irb/commit/bbd20445ea
This commit is contained in:
Stan Lo 2023-08-04 18:13:51 +01:00 коммит произвёл git
Родитель fc0b2a8df2
Коммит c4066af35e
2 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -87,6 +87,8 @@ module TestIRB
unless defined?(PTY)
omit "Integration tests require PTY."
end
@envs = {}
end
def run_ruby_file(&block)
@ -98,7 +100,7 @@ module TestIRB
yield
PTY.spawn(integration_envs.merge("TERM" => "dumb"), *cmd) do |read, write, pid|
PTY.spawn(@envs.merge("TERM" => "dumb"), *cmd) do |read, write, pid|
Timeout.timeout(TIMEOUT_SEC) do
while line = safe_gets(read)
lines << line
@ -178,9 +180,5 @@ module TestIRB
@ruby_file.write(program)
@ruby_file.close
end
def integration_envs
{}
end
end
end

Просмотреть файл

@ -8,6 +8,8 @@ require_relative "helper"
module TestIRB
class DebugCommandTest < IntegrationTestCase
def setup
super
if ruby_core?
omit "This test works only under ruby/irb"
end
@ -15,6 +17,8 @@ module TestIRB
if RUBY_ENGINE == 'truffleruby'
omit "This test runs with ruby/debug, which doesn't work with truffleruby"
end
@envs.merge!("NO_COLOR" => "true", "RUBY_DEBUG_HISTORY_FILE" => '')
end
def test_backtrace
@ -189,11 +193,5 @@ module TestIRB
assert_match(/\(rdbg:irb\) catch/, output)
assert_match(/Stop by #0 BP - Catch "ZeroDivisionError"/, output)
end
private
def integration_envs
{ "NO_COLOR" => "true", "RUBY_DEBUG_HISTORY_FILE" => '' }
end
end
end