[ruby/irb] Suppress colorize on Windows tests

https://github.com/ruby/irb/commit/5be9354cf9
This commit is contained in:
aycabta 2021-02-08 11:08:57 +09:00 committed by git
parent d77a42fbfd
commit b2d2d25b94
2 changed files with 7 additions and 1 deletions

View File

@ -175,7 +175,7 @@ EOF
body = (start_pos..end_pos).map do |current_pos|
sprintf(fmt, pos == current_pos ? '=>' : '', current_pos + 1, lines[current_pos])
end.join("")
"\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n"
"\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear if use_colorize}\n"
end
def IRB.delete_caller

View File

@ -9,6 +9,7 @@ require 'irb/color'
module TestIRB
class TestWorkSpace < Test::Unit::TestCase
def test_code_around_binding
IRB.conf[:USE_COLORIZE] = false
Tempfile.create('irb') do |f|
code = <<~RUBY
# 1
@ -33,6 +34,8 @@ module TestIRB
EOS
end
ensure
IRB.conf.delete(:USE_COLORIZE)
end
def test_code_around_binding_with_existing_unreadable_file
@ -52,6 +55,7 @@ module TestIRB
end
def test_code_around_binding_with_script_lines__
IRB.conf[:USE_COLORIZE] = false
with_script_lines do |script_lines|
Tempfile.create('irb') do |f|
code = "IRB::WorkSpace.new(binding)\n"
@ -67,6 +71,8 @@ module TestIRB
EOS
end
end
ensure
IRB.conf.delete(:USE_COLORIZE)
end
def test_code_around_binding_on_irb