summaryrefslogtreecommitdiff
path: root/test/irb/test_workspace.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/irb/test_workspace.rb')
-rw-r--r--test/irb/test_workspace.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/irb/test_workspace.rb b/test/irb/test_workspace.rb
index 0795b17e09..9c87468cf7 100644
--- a/test/irb/test_workspace.rb
+++ b/test/irb/test_workspace.rb
@@ -2,6 +2,7 @@
require 'test/unit'
require 'tempfile'
require 'irb/workspace'
+require 'irb/color'
module TestIRB
class TestWorkSpace < Test::Unit::TestCase
@@ -18,7 +19,7 @@ module TestIRB
f.close
workspace = eval(code, binding, f.path)
- assert_equal(<<~EOS, workspace.code_around_binding)
+ assert_equal(<<~EOS, without_term { workspace.code_around_binding })
From: #{f.path} @ line 3 :
@@ -55,7 +56,7 @@ module TestIRB
script_lines[f.path] = code.split(/^/)
workspace = eval(code, binding, f.path)
- assert_equal(<<~EOS, workspace.code_around_binding)
+ assert_equal(<<~EOS, without_term { workspace.code_around_binding })
From: #{f.path} @ line 1 :
@@ -90,5 +91,13 @@ module TestIRB
const_set(:SCRIPT_LINES__, script_lines) if script_lines
end
end
+
+ def without_term
+ env = ENV.to_h.dup
+ ENV.delete('TERM')
+ yield
+ ensure
+ ENV.replace(env)
+ end
end
end