ruby-changes:55839
From: Takashi <ko1@a...>
Date: Sun, 26 May 2019 06:15:33 +0900 (JST)
Subject: [ruby-changes:55839] Takashi Kokubun: 208ed56e57 (trunk): Colorize empty embexpr more on IRB::Color
https://git.ruby-lang.org/ruby.git/commit/?id=208ed56e57 From 208ed56e575b83c47d5cc2e48efd6807bb661bdd Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sat, 25 May 2019 13:54:03 -0700 Subject: Colorize empty embexpr more on IRB::Color diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 7bd1799..9c4370a 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -22,8 +22,8 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L22 TOKEN_SEQ_EXPRS = { on_CHAR: [[BLUE, BOLD], [Ripper::EXPR_END]], on_const: [[BLUE, BOLD, UNDERLINE], [Ripper::EXPR_ARG, Ripper::EXPR_CMDARG, Ripper::EXPR_ENDFN]], - on_embexpr_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END]], - on_embexpr_end: [[RED], [Ripper::EXPR_END, Ripper::EXPR_ENDFN, Ripper::EXPR_CMDARG]], + on_embexpr_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_FNAME]], + on_embexpr_end: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_ENDFN, Ripper::EXPR_CMDARG]], on_embvar: [[RED], [Ripper::EXPR_BEG]], on_heredoc_beg: [[RED], [Ripper::EXPR_BEG]], on_heredoc_end: [[RED], [Ripper::EXPR_BEG]], diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 95ed190..c723f91 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -42,6 +42,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L42 "{'a': 1}" => "{#{RED}'#{CLEAR}#{RED}a#{CLEAR}#{RED}':#{CLEAR} #{BLUE}#{BOLD}1#{CLEAR}}", ":Struct" => "#{BLUE}#{BOLD}:#{CLEAR}#{BLUE}#{BOLD}#{UNDERLINE}Struct#{CLEAR}", "<<EOS\nhere\nEOS" => "#{RED}<<EOS#{CLEAR}\n#{RED}here#{CLEAR}\n#{RED}EOS#{CLEAR}", + '"#{}"' => "#{RED}\"#{CLEAR}#{RED}\#{#{CLEAR}#{RED}}#{CLEAR}#{RED}\"#{CLEAR}", }.each do |code, result| actual = with_term { IRB::Color.colorize_code(code) } assert_equal(result, actual, "Case: colorize_code(#{code.dump})\nResult: #{humanized_literal(actual)}") -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/