summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-08-04 18:13:51 +0100
committergit <svn-admin@ruby-lang.org>2023-08-04 17:13:55 +0000
commitc4066af35e6578aee39a1324d6209f45b0bfa265 (patch)
treeb7cd6a67ea0aa9ae1c78e206d532f19c6764a3cf /test
parentfc0b2a8df2327b40a2f6667c1567b3f8264b58a5 (diff)
[ruby/irb] Store integration tests' envs in an ivar
(https://github.com/ruby/irb/pull/668) https://github.com/ruby/irb/commit/bbd20445ea
Diffstat (limited to 'test')
-rw-r--r--test/irb/helper.rb8
-rw-r--r--test/irb/test_debug_cmd.rb10
2 files changed, 7 insertions, 11 deletions
diff --git a/test/irb/helper.rb b/test/irb/helper.rb
index 650b95d8f6..2372305d63 100644
--- a/test/irb/helper.rb
+++ b/test/irb/helper.rb
@@ -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
diff --git a/test/irb/test_debug_cmd.rb b/test/irb/test_debug_cmd.rb
index aa0321b66f..d4cd87c750 100644
--- a/test/irb/test_debug_cmd.rb
+++ b/test/irb/test_debug_cmd.rb
@@ -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