@@ -90,6 +90,7 @@ def test_colorize_code
90
90
"__END__" => "#{ GREEN } __END__#{ CLEAR } " ,
91
91
"foo\n __END__\n bar" => "foo\n #{ GREEN } __END__#{ CLEAR } \n bar" ,
92
92
"foo\n <<A\0 \0 bar\n A\n baz" => "foo\n #{ RED } <<A#{ CLEAR } ^@^@bar\n #{ RED } A#{ CLEAR } \n baz" ,
93
+ "<<A+1\n A" => "#{ RED } <<A#{ CLEAR } +#{ BLUE } #{ BOLD } 1#{ CLEAR } \n #{ RED } A#{ CLEAR } " ,
93
94
}
94
95
95
96
# specific to Ruby 2.7+
@@ -114,11 +115,18 @@ def test_colorize_code
114
115
"def req(@a) end" => "#{ GREEN } def#{ CLEAR } #{ BLUE } #{ BOLD } req#{ CLEAR } (#{ RED } #{ REVERSE } @a#{ CLEAR } ) #{ GREEN } end#{ CLEAR } " ,
115
116
} )
116
117
else
117
- tests . merge! ( {
118
- "[1]]]\u0013 " => "[1]]]^S" ,
118
+ if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '2.7.0' )
119
+ tests . merge! ( {
120
+ "[1]]]\u0013 " => "[#{ BLUE } #{ BOLD } 1#{ CLEAR } ]#{ RED } #{ REVERSE } ]#{ CLEAR } ]^S" ,
121
+ "def req(true) end" => "#{ GREEN } def#{ CLEAR } #{ BLUE } #{ BOLD } req#{ CLEAR } (#{ RED } #{ REVERSE } true#{ CLEAR } ) end" ,
122
+ } )
123
+ else
124
+ tests . merge! ( {
125
+ "[1]]]\u0013 " => "[#{ BLUE } #{ BOLD } 1#{ CLEAR } ]]]^S" ,
126
+ "def req(true) end" => "#{ GREEN } def#{ CLEAR } #{ BLUE } #{ BOLD } req#{ CLEAR } (#{ CYAN } #{ BOLD } true#{ CLEAR } ) end" ,
119
127
} )
128
+ end
120
129
tests . merge! ( {
121
- "def req(true) end" => "def req(true) end" ,
122
130
"nil = 1" => "#{ CYAN } #{ BOLD } nil#{ CLEAR } = #{ BLUE } #{ BOLD } 1#{ CLEAR } " ,
123
131
"alias $x $1" => "#{ GREEN } alias#{ CLEAR } #{ GREEN } #{ BOLD } $x#{ CLEAR } $1" ,
124
132
"class bad; end" => "#{ GREEN } class#{ CLEAR } bad; #{ GREEN } end#{ CLEAR } " ,
0 commit comments