diff --git a/test/console/color_test.rb b/test/console/color_test.rb index 8f62dce45..f81b6b051 100644 --- a/test/console/color_test.rb +++ b/test/console/color_test.rb @@ -33,7 +33,14 @@ def bar end end - { "#{GREEN}##{CLEAR}\n": dummy_class.new('b'), + # IRB >= 1.18.0 highlights struct member names in cyan (ruby/irb#1189) + if defined?(IRB::VERSION) && Gem::Version.new(IRB::VERSION) >= Gem::Version.new("1.18.0") + struct_foo = "#{CYAN}foo#{CLEAR}" + else + struct_foo = "foo" + end + + { "#{GREEN}##{CLEAR}\n": dummy_class.new('b'), "#{RED}#{BOLD}\"#{CLEAR}#{RED}hoge#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}\n": 'hoge'}.each do |k, v| expected = k.to_s obj = v