ruby-changes:65235
From: aycabta <ko1@a...>
Date: Thu, 11 Feb 2021 20:31:41 +0900 (JST)
Subject: [ruby-changes:65235] b2d2d25b94 (master): [ruby/irb] Suppress colorize on Windows tests
https://git.ruby-lang.org/ruby.git/commit/?id=b2d2d25b94 From b2d2d25b94fd9699408759f5b8b394f54f57ef89 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 8 Feb 2021 11:08:57 +0900 Subject: [ruby/irb] Suppress colorize on Windows tests https://github.com/ruby/irb/commit/5be9354cf9 --- lib/irb/workspace.rb | 2 +- test/irb/test_workspace.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index c6c328e..78d434d 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -175,7 +175,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/irb/workspace.rb#L175 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 diff --git a/test/irb/test_workspace.rb b/test/irb/test_workspace.rb index 15c7731..f028fc3 100644 --- a/test/irb/test_workspace.rb +++ b/test/irb/test_workspace.rb @@ -9,6 +9,7 @@ require 'irb/color' https://github.com/ruby/ruby/blob/trunk/test/irb/test_workspace.rb#L9 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 https://github.com/ruby/ruby/blob/trunk/test/irb/test_workspace.rb#L34 EOS end + ensure + IRB.conf.delete(:USE_COLORIZE) end def test_code_around_binding_with_existing_unreadable_file @@ -52,6 +55,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_workspace.rb#L55 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 https://github.com/ruby/ruby/blob/trunk/test/irb/test_workspace.rb#L71 EOS end end + ensure + IRB.conf.delete(:USE_COLORIZE) end def test_code_around_binding_on_irb -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/