diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-25 08:01:51 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-25 08:19:15 -0700 |
commit | 98be203704e98c53b2d3b939b10a0d765c76d53d (patch) | |
tree | 32639626fe6bc43e8dcc174bee2b550e8a61c6bc /test/irb | |
parent | a4d44b08ec5139f91617f0fc5786494c5076aaa1 (diff) |
Support some unhandled syntax highlight
Heredoc, %i, :Foo, { 'a': ... }, ...
:'a' is still half-broken.
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_color.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 1d7d74e151..95ed190dae 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -1,6 +1,7 @@ # frozen_string_literal: false require 'test/unit' require 'irb/color' +require 'rubygems' require 'stringio' module TestIRB @@ -36,6 +37,11 @@ module TestIRB "4.5.6" => "4.5.6", "[1]]]" => "[1]]]", "\e[0m\n" => "^[[#{BLUE}#{BOLD}0#{CLEAR}m\n", + "%w[a b]" => "#{RED}%w[#{CLEAR}#{RED}a#{CLEAR} #{RED}b#{CLEAR}#{RED}]#{CLEAR}", + "%i[c d]" => "#{RED}%i[#{CLEAR}#{RED}c#{CLEAR} #{RED}d#{CLEAR}#{RED}]#{CLEAR}", + "{'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}", }.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)}") |