mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 14:05:02 +02:00
[ruby/irb] Store integration tests' envs in an ivar
(https://github.com/ruby/irb/pull/668)
bbd20445ea
This commit is contained in:
parent
fc0b2a8df2
commit
c4066af35e
2 changed files with 7 additions and 11 deletions
|
@ -87,6 +87,8 @@ module TestIRB
|
||||||
unless defined?(PTY)
|
unless defined?(PTY)
|
||||||
omit "Integration tests require PTY."
|
omit "Integration tests require PTY."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@envs = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_ruby_file(&block)
|
def run_ruby_file(&block)
|
||||||
|
@ -98,7 +100,7 @@ module TestIRB
|
||||||
|
|
||||||
yield
|
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
|
Timeout.timeout(TIMEOUT_SEC) do
|
||||||
while line = safe_gets(read)
|
while line = safe_gets(read)
|
||||||
lines << line
|
lines << line
|
||||||
|
@ -178,9 +180,5 @@ module TestIRB
|
||||||
@ruby_file.write(program)
|
@ruby_file.write(program)
|
||||||
@ruby_file.close
|
@ruby_file.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def integration_envs
|
|
||||||
{}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,8 @@ require_relative "helper"
|
||||||
module TestIRB
|
module TestIRB
|
||||||
class DebugCommandTest < IntegrationTestCase
|
class DebugCommandTest < IntegrationTestCase
|
||||||
def setup
|
def setup
|
||||||
|
super
|
||||||
|
|
||||||
if ruby_core?
|
if ruby_core?
|
||||||
omit "This test works only under ruby/irb"
|
omit "This test works only under ruby/irb"
|
||||||
end
|
end
|
||||||
|
@ -15,6 +17,8 @@ module TestIRB
|
||||||
if RUBY_ENGINE == 'truffleruby'
|
if RUBY_ENGINE == 'truffleruby'
|
||||||
omit "This test runs with ruby/debug, which doesn't work with truffleruby"
|
omit "This test runs with ruby/debug, which doesn't work with truffleruby"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@envs.merge!("NO_COLOR" => "true", "RUBY_DEBUG_HISTORY_FILE" => '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_backtrace
|
def test_backtrace
|
||||||
|
@ -189,11 +193,5 @@ module TestIRB
|
||||||
assert_match(/\(rdbg:irb\) catch/, output)
|
assert_match(/\(rdbg:irb\) catch/, output)
|
||||||
assert_match(/Stop by #0 BP - Catch "ZeroDivisionError"/, output)
|
assert_match(/Stop by #0 BP - Catch "ZeroDivisionError"/, output)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def integration_envs
|
|
||||||
{ "NO_COLOR" => "true", "RUBY_DEBUG_HISTORY_FILE" => '' }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue