summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-01-07 22:41:58 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2021-01-07 22:43:40 -0800
commit98bd7e87a08b86c7aa95502428015c3f7b4aae75 (patch)
tree20466d9062363559cf1fdaaa331bf9655dc639b1 /test/irb
parentd6b2b5bd47952efb6928db7ff1d393f6973e7ccd (diff)
[ruby/irb] Make IRB::ColorPrinter.pp compatible with PP.pp
The incompatible interface is not helpful, again if you want to use it as a standalone library, falling it back to PP. Original PP.pp also ends with `out << "\n"`. https://github.com/ruby/irb/commit/4c74c7d84c
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_color.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb
index 6ce6521..203b605 100644
--- a/test/irb/test_color.rb
+++ b/test/irb/test_color.rb
@@ -158,9 +158,9 @@ module TestIRB
skip 'Ripper::Lexer#scan is supported in Ruby 2.7+'
end
{
- 1 => "#{BLUE}#{BOLD}1#{CLEAR}",
- Struct.new('IRBTestColorPrinter', :a).new('test') => "#{GREEN}#<struct Struct::IRBTestColorPrinter#{CLEAR} a#{GREEN}=#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{RED}test#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{GREEN}>#{CLEAR}",
- Ripper::Lexer.new('1').scan => "[#{GREEN}#<Ripper::Lexer::Elem:#{CLEAR} on_int@1:0 END token: #{RED}#{BOLD}\"#{CLEAR}#{RED}1#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{GREEN}>#{CLEAR}]",
+ 1 => "#{BLUE}#{BOLD}1#{CLEAR}\n",
+ Struct.new('IRBTestColorPrinter', :a).new('test') => "#{GREEN}#<struct Struct::IRBTestColorPrinter#{CLEAR} a#{GREEN}=#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{RED}test#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{GREEN}>#{CLEAR}\n",
+ Ripper::Lexer.new('1').scan => "[#{GREEN}#<Ripper::Lexer::Elem:#{CLEAR} on_int@1:0 END token: #{RED}#{BOLD}\"#{CLEAR}#{RED}1#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{GREEN}>#{CLEAR}]\n",
}.each do |object, result|
actual = with_term { IRB::ColorPrinter.pp(object, '') }
assert_equal(result, actual, "Case: IRB::ColorPrinter.pp(#{object.inspect}, '')")