mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Syntax-highlight yield in IRB
This commit is contained in:
parent
2422316aea
commit
0408b8b390
2 changed files with 2 additions and 1 deletions
|
@ -25,7 +25,7 @@ module IRB # :nodoc:
|
|||
on_ident: [[BLUE, BOLD], [Ripper::EXPR_ENDFN]],
|
||||
on_int: [[BLUE, BOLD], [Ripper::EXPR_END]],
|
||||
on_float: [[MAGENTA, BOLD], [Ripper::EXPR_END]],
|
||||
on_kw: [[GREEN], [Ripper::EXPR_CLASS, Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_FNAME]],
|
||||
on_kw: [[GREEN], [Ripper::EXPR_ARG, Ripper::EXPR_CLASS, Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_FNAME]],
|
||||
on_label: [[MAGENTA], [Ripper::EXPR_LABELED]],
|
||||
on_qwords_beg: [[RED], [Ripper::EXPR_BEG]],
|
||||
on_regexp_beg: [[RED, BOLD], [Ripper::EXPR_BEG]],
|
||||
|
|
|
@ -24,6 +24,7 @@ module TestIRB
|
|||
'ERB.new("a#{nil}b", trim_mode: "-")' => "#{BLUE}#{BOLD}#{UNDERLINE}ERB#{CLEAR}.new(#{RED}\"#{CLEAR}#{RED}a#{CLEAR}#{RED}\#{#{CLEAR}#{CYAN}#{BOLD}nil#{CLEAR}#{RED}}#{CLEAR}#{RED}b#{CLEAR}#{RED}\"#{CLEAR}, #{MAGENTA}trim_mode:#{CLEAR} #{RED}\"#{CLEAR}#{RED}-#{CLEAR}#{RED}\"#{CLEAR})",
|
||||
"# comment" => "#{BLUE}#{BOLD}# comment#{CLEAR}",
|
||||
'/r#{e}g/' => "#{RED}#{BOLD}/#{CLEAR}#{RED}r#{CLEAR}#{RED}\#{#{CLEAR}e}#{RED}g#{CLEAR}#{RED}#{BOLD}/#{CLEAR}",
|
||||
"yield(hello)" => "#{GREEN}yield#{CLEAR}(hello)",
|
||||
}.each do |code, result|
|
||||
assert_equal(result, with_term { IRB::Color.colorize_code(code) })
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue