Skip to content

Commit 52446eb

Browse files
committed
Update expected colorize result that were uncolored before
1 parent d14e56a commit 52446eb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/irb/test_color.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_colorize_code
9090
"__END__" => "#{GREEN}__END__#{CLEAR}",
9191
"foo\n__END__\nbar" => "foo\n#{GREEN}__END__#{CLEAR}\nbar",
9292
"foo\n<<A\0\0bar\nA\nbaz" => "foo\n#{RED}<<A#{CLEAR}^@^@bar\n#{RED}A#{CLEAR}\nbaz",
93+
"<<A+1\nA" => "#{RED}<<A#{CLEAR}+#{BLUE}#{BOLD}1#{CLEAR}\n#{RED}A#{CLEAR}",
9394
}
9495

9596
# specific to Ruby 2.7+
@@ -114,11 +115,18 @@ def test_colorize_code
114115
"def req(@a) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{RED}#{REVERSE}@a#{CLEAR}) #{GREEN}end#{CLEAR}",
115116
})
116117
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",
119127
})
128+
end
120129
tests.merge!({
121-
"def req(true) end" => "def req(true) end",
122130
"nil = 1" => "#{CYAN}#{BOLD}nil#{CLEAR} = #{BLUE}#{BOLD}1#{CLEAR}",
123131
"alias $x $1" => "#{GREEN}alias#{CLEAR} #{GREEN}#{BOLD}$x#{CLEAR} $1",
124132
"class bad; end" => "#{GREEN}class#{CLEAR} bad; #{GREEN}end#{CLEAR}",

0 commit comments

Comments
 (0)