Skip to content

Commit

Permalink
Suppress constant redefinition warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and aycabta committed Jan 12, 2021
1 parent c230d08 commit 1a1cdf9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/irb/test_color.rb
Expand Up @@ -153,13 +153,15 @@ def test_colorize_code_complete_false
end
end

IRBTestColorPrinter = Struct.new(:a)

def test_color_printer
unless ripper_lexer_scan_supported?
skip 'Ripper::Lexer#scan is supported in Ruby 2.7+'
end
{
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",
IRBTestColorPrinter.new('test') => "#{GREEN}#<struct TestIRB::TestColor::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, '') }
Expand Down

0 comments on commit 1a1cdf9

Please sign in to comment.