Skip to content

Commit

Permalink
Store integration tests' envs in an ivar (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Aug 4, 2023
1 parent 79fc6dc commit bbd2044
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
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

0 comments on commit bbd2044

Please sign in to comment.