[ruby/irb] Stub a screen size for test_context

http://ci.rvm.jp/logfiles/brlog.trunk-random1.20210119-074232

https://github.com/ruby/irb/commit/ea87592d4a
This commit is contained in:
Takashi Kokubun 2021-01-19 00:14:12 -08:00
parent 4da4ad69bb
commit e6af81bde1
2 changed files with 11 additions and 2 deletions

View File

@ -19,7 +19,6 @@ module TestIRB
CYAN = "\e[36m"
def setup
super
@get_screen_size = Reline.method(:get_screen_size)
Reline.instance_eval { undef :get_screen_size }
def Reline.get_screen_size
@ -30,7 +29,6 @@ module TestIRB
def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
super
end
def test_colorize_code

View File

@ -42,6 +42,17 @@ module TestIRB
IRB.conf[:VERBOSE] = false
workspace = IRB::WorkSpace.new(Object.new)
@context = IRB::Context.new(nil, workspace, TestInputMethod.new)
@get_screen_size = Reline.method(:get_screen_size)
Reline.instance_eval { undef :get_screen_size }
def Reline.get_screen_size
[36, 80]
end
end
def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
end
def test_last_value