diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-04-25 21:36:48 +0900 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-04-26 00:47:40 +0900 |
commit | b55201dd099011a22c8c1d64c653f898d9b409ca (patch) | |
tree | 46de68fc066327b2fcc9a3c3592f9e25b2cad9ee /test/irb | |
parent | 94af6cd383f9dc3ae1204a5fba8f56ee7826cbce (diff) | |
download | ruby-b55201dd099011a22c8c1d64c653f898d9b409ca.tar.gz |
Colorize IRB's inspect result
Closes: https://github.com/ruby/ruby/pull/2150
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_color.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 0c41613f51..088611c645 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -26,5 +26,19 @@ module TestIRB assert_equal(result, IRB::Color.colorize_code(code)) end end + + def test_inspect_colorable + { + 1 => true, + 2.3 => true, + ['foo', :bar] => true, + { a: 4 } => true, + Object.new => false, + Struct.new(:a) => false, + Struct.new(:a).new(1) => false, + }.each do |object, result| + assert_equal(result, IRB::Color.inspect_colorable?(object)) + end + end end end |