Skip to content

Commit 1a1cdf9

Browse files
nobuaycabta
authored andcommitted
Suppress constant redefinition warnings
1 parent c230d08 commit 1a1cdf9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/irb/test_color.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ def test_colorize_code_complete_false
153153
end
154154
end
155155

156+
IRBTestColorPrinter = Struct.new(:a)
157+
156158
def test_color_printer
157159
unless ripper_lexer_scan_supported?
158160
skip 'Ripper::Lexer#scan is supported in Ruby 2.7+'
159161
end
160162
{
161163
1 => "#{BLUE}#{BOLD}1#{CLEAR}\n",
162-
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",
164+
IRBTestColorPrinter.new('test') => "#{GREEN}#<struct TestIRB::TestColor::IRBTestColorPrinter#{CLEAR} a#{GREEN}=#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{RED}test#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}#{GREEN}>#{CLEAR}\n",
163165
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",
164166
}.each do |object, result|
165167
actual = with_term { IRB::ColorPrinter.pp(object, '') }

0 commit comments

Comments
 (0)