diff options
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_color.rb | 14 | ||||
-rw-r--r-- | test/irb/test_color_printer.rb | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 1b27afb898..ca4ae4b8f9 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -18,6 +18,20 @@ module TestIRB MAGENTA = "\e[35m" CYAN = "\e[36m" + def setup + super + if IRB.respond_to?(:conf) + @colorize, IRB.conf[:USE_COLORIZE] = IRB.conf[:USE_COLORIZE], true + end + end + + def teardown + if instance_variable_defined?(:@colorize) + IRB.conf[:USE_COLORIZE] = @colorize + end + super + end + def test_colorize text = "text" { 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) |