[ruby/irb] Test colors with enabling colors
https://github.com/ruby/irb/commit/998b7a74fa
This commit is contained in:
parent
d93d786338
commit
a968d783a3
@ -18,6 +18,20 @@ module TestIRB
|
|||||||
MAGENTA = "\e[35m"
|
MAGENTA = "\e[35m"
|
||||||
CYAN = "\e[36m"
|
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
|
def test_colorize
|
||||||
text = "text"
|
text = "text"
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,10 @@ module TestIRB
|
|||||||
CYAN = "\e[36m"
|
CYAN = "\e[36m"
|
||||||
|
|
||||||
def setup
|
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)
|
@get_screen_size = Reline.method(:get_screen_size)
|
||||||
Reline.instance_eval { undef :get_screen_size }
|
Reline.instance_eval { undef :get_screen_size }
|
||||||
def Reline.get_screen_size
|
def Reline.get_screen_size
|
||||||
@ -25,6 +29,10 @@ module TestIRB
|
|||||||
def teardown
|
def teardown
|
||||||
Reline.instance_eval { undef :get_screen_size }
|
Reline.instance_eval { undef :get_screen_size }
|
||||||
Reline.define_singleton_method(:get_screen_size, @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
|
end
|
||||||
|
|
||||||
IRBTestColorPrinter = Struct.new(:a)
|
IRBTestColorPrinter = Struct.new(:a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user