summaryrefslogtreecommitdiff
path: root/test/irb/test_color_printer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/irb/test_color_printer.rb')
-rw-r--r--test/irb/test_color_printer.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/irb/test_color_printer.rb b/test/irb/test_color_printer.rb
index 79ab050550..41a7345bd3 100644
--- a/test/irb/test_color_printer.rb
+++ b/test/irb/test_color_printer.rb
@@ -15,6 +15,10 @@ module TestIRB
CYAN = "\e[36m"
def setup
+ super
+ if IRB.respond_to?(:conf)
+ @colorize, IRB.conf[:USE_COLORIZE] = IRB.conf[:USE_COLORIZE], true
+ end
@get_screen_size = Reline.method(:get_screen_size)
Reline.instance_eval { undef :get_screen_size }
def Reline.get_screen_size
@@ -25,6 +29,10 @@ module TestIRB
def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
+ if instance_variable_defined?(:@colorize)
+ IRB.conf[:USE_COLORIZE] = @colorize
+ end
+ super
end
IRBTestColorPrinter = Struct.new(:a)