Colorize empty embexpr more on IRB::Color

This commit is contained in:
Takashi Kokubun 2019-05-25 13:54:03 -07:00
Родитель ec75901120
Коммит 208ed56e57
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6FFC433B12EE23DD
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -22,8 +22,8 @@ module IRB # :nodoc:
TOKEN_SEQ_EXPRS = { TOKEN_SEQ_EXPRS = {
on_CHAR: [[BLUE, BOLD], [Ripper::EXPR_END]], on_CHAR: [[BLUE, BOLD], [Ripper::EXPR_END]],
on_const: [[BLUE, BOLD, UNDERLINE], [Ripper::EXPR_ARG, Ripper::EXPR_CMDARG, Ripper::EXPR_ENDFN]], 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_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_FNAME]],
on_embexpr_end: [[RED], [Ripper::EXPR_END, Ripper::EXPR_ENDFN, Ripper::EXPR_CMDARG]], on_embexpr_end: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_ENDFN, Ripper::EXPR_CMDARG]],
on_embvar: [[RED], [Ripper::EXPR_BEG]], on_embvar: [[RED], [Ripper::EXPR_BEG]],
on_heredoc_beg: [[RED], [Ripper::EXPR_BEG]], on_heredoc_beg: [[RED], [Ripper::EXPR_BEG]],
on_heredoc_end: [[RED], [Ripper::EXPR_BEG]], on_heredoc_end: [[RED], [Ripper::EXPR_BEG]],

Просмотреть файл

@ -42,6 +42,7 @@ module TestIRB
"{'a': 1}" => "{#{RED}'#{CLEAR}#{RED}a#{CLEAR}#{RED}':#{CLEAR} #{BLUE}#{BOLD}1#{CLEAR}}", "{'a': 1}" => "{#{RED}'#{CLEAR}#{RED}a#{CLEAR}#{RED}':#{CLEAR} #{BLUE}#{BOLD}1#{CLEAR}}",
":Struct" => "#{BLUE}#{BOLD}:#{CLEAR}#{BLUE}#{BOLD}#{UNDERLINE}Struct#{CLEAR}", ":Struct" => "#{BLUE}#{BOLD}:#{CLEAR}#{BLUE}#{BOLD}#{UNDERLINE}Struct#{CLEAR}",
"<<EOS\nhere\nEOS" => "#{RED}<<EOS#{CLEAR}\n#{RED}here#{CLEAR}\n#{RED}EOS#{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| }.each do |code, result|
actual = with_term { IRB::Color.colorize_code(code) } actual = with_term { IRB::Color.colorize_code(code) }
assert_equal(result, actual, "Case: colorize_code(#{code.dump})\nResult: #{humanized_literal(actual)}") assert_equal(result, actual, "Case: colorize_code(#{code.dump})\nResult: #{humanized_literal(actual)}")