зеркало из https://github.com/github/ruby.git
[ruby/irb] Test colors with enabling colors
https://github.com/ruby/irb/commit/998b7a74fa
This commit is contained in:
Родитель
d93d786338
Коммит
a968d783a3
|
@ -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"
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче