mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Highlight global variable on IRB
This commit is contained in:
parent
7597f7ecb1
commit
64ee8900c8
2 changed files with 3 additions and 1 deletions
|
@ -30,12 +30,13 @@ module IRB # :nodoc:
|
||||||
TOKEN_SEQ_EXPRS = {
|
TOKEN_SEQ_EXPRS = {
|
||||||
on_CHAR: [[BLUE, BOLD], ALL],
|
on_CHAR: [[BLUE, BOLD], ALL],
|
||||||
on_backtick: [[RED], ALL],
|
on_backtick: [[RED], ALL],
|
||||||
on_const: [[BLUE, BOLD, UNDERLINE], ALL],
|
|
||||||
on_comment: [[BLUE, BOLD], ALL],
|
on_comment: [[BLUE, BOLD], ALL],
|
||||||
|
on_const: [[BLUE, BOLD, UNDERLINE], ALL],
|
||||||
on_embexpr_beg: [[RED], ALL],
|
on_embexpr_beg: [[RED], ALL],
|
||||||
on_embexpr_end: [[RED], ALL],
|
on_embexpr_end: [[RED], ALL],
|
||||||
on_embvar: [[RED], ALL],
|
on_embvar: [[RED], ALL],
|
||||||
on_float: [[MAGENTA, BOLD], ALL],
|
on_float: [[MAGENTA, BOLD], ALL],
|
||||||
|
on_gvar: [[GREEN, BOLD], ALL],
|
||||||
on_heredoc_beg: [[RED], ALL],
|
on_heredoc_beg: [[RED], ALL],
|
||||||
on_heredoc_end: [[RED], ALL],
|
on_heredoc_end: [[RED], ALL],
|
||||||
on_ident: [[BLUE, BOLD], Ripper::EXPR_ENDFN],
|
on_ident: [[BLUE, BOLD], Ripper::EXPR_ENDFN],
|
||||||
|
|
|
@ -64,6 +64,7 @@ module TestIRB
|
||||||
"`echo`" => "#{RED}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}`#{CLEAR}",
|
"`echo`" => "#{RED}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}`#{CLEAR}",
|
||||||
"\t" => "\t", # not ^I
|
"\t" => "\t", # not ^I
|
||||||
"foo(*%W(bar))" => "foo(*#{RED}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED})#{CLEAR})",
|
"foo(*%W(bar))" => "foo(*#{RED}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED})#{CLEAR})",
|
||||||
|
"$stdout" => "#{GREEN}#{BOLD}$stdout#{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)}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue