Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store integration tests' envs in an ivar #668

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions test/irb/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def setup
unless defined?(PTY)
omit "Integration tests require PTY."
end

@envs = {}
end

def run_ruby_file(&block)
Expand All @@ -98,7 +100,7 @@ def run_ruby_file(&block)

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
Expand Down Expand Up @@ -178,9 +180,5 @@ def write_ruby(program)
@ruby_file.write(program)
@ruby_file.close
end

def integration_envs
{}
end
end
end
10 changes: 4 additions & 6 deletions test/irb/test_debug_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
module TestIRB
class DebugCommandTest < IntegrationTestCase
def setup
super

if ruby_core?
omit "This test works only under ruby/irb"
end

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
Expand Down Expand Up @@ -189,11 +193,5 @@ def test_catch
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