[前][次][番号順一覧][スレッド一覧]

ruby-changes:73670

From: tompng <ko1@a...>
Date: Thu, 22 Sep 2022 00:37:52 +0900 (JST)
Subject: [ruby-changes:73670] 78cb638002 (master): [ruby/irb] Update expected colorize result that were uncolored before

https://git.ruby-lang.org/ruby.git/commit/?id=78cb638002

From 78cb6380027f67c631de93b91f7da88976189e0f Mon Sep 17 00:00:00 2001
From: tompng <tomoyapenguin@g...>
Date: Thu, 11 Aug 2022 06:15:32 +0900
Subject: [ruby/irb] Update expected colorize result that were uncolored before

https://github.com/ruby/irb/commit/52446eb77f
---
 test/irb/test_color.rb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb
index 73e9b389c2..dc394f9d68 100644
--- a/test/irb/test_color.rb
+++ b/test/irb/test_color.rb
@@ -90,6 +90,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L90
         "__END__" => "#{GREEN}__END__#{CLEAR}",
         "foo\n__END__\nbar" => "foo\n#{GREEN}__END__#{CLEAR}\nbar",
         "foo\n<<A\0\0bar\nA\nbaz" => "foo\n#{RED}<<A#{CLEAR}^@^@bar\n#{RED}A#{CLEAR}\nbaz",
+        "<<A+1\nA" => "#{RED}<<A#{CLEAR}+#{BLUE}#{BOLD}1#{CLEAR}\n#{RED}A#{CLEAR}",
       }
 
       # specific to Ruby 2.7+
@@ -114,11 +115,18 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L115
           "def req(@a) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{RED}#{REVERSE}@a#{CLEAR}) #{GREEN}end#{CLEAR}",
         })
       else
-        tests.merge!({
-          "[1]]]\u0013" => "[1]]]^S",
+        if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
+          tests.merge!({
+            "[1]]]\u0013" => "[#{BLUE}#{BOLD}1#{CLEAR}]#{RED}#{REVERSE}]#{CLEAR}]^S",
+            "def req(true) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{RED}#{REVERSE}true#{CLEAR}) end",
+          })
+        else
+          tests.merge!({
+            "[1]]]\u0013" => "[#{BLUE}#{BOLD}1#{CLEAR}]]]^S",
+            "def req(true) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{CYAN}#{BOLD}true#{CLEAR}) end",
           })
+        end
         tests.merge!({
-          "def req(true) end" => "def req(true) end",
           "nil = 1" => "#{CYAN}#{BOLD}nil#{CLEAR} = #{BLUE}#{BOLD}1#{CLEAR}",
           "alias $x $1" => "#{GREEN}alias#{CLEAR} #{GREEN}#{BOLD}$x#{CLEAR} $1",
           "class bad; end" => "#{GREEN}class#{CLEAR} bad; #{GREEN}end#{CLEAR}",
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]