[ruby/irb] Stub a screen size for tests

https://github.com/ruby/irb/commit/6663057083
This commit is contained in:
Takashi Kokubun 2021-01-18 23:35:31 -08:00
parent 82386f21b9
commit b2159f7c38

View File

@ -18,6 +18,21 @@ module TestIRB
MAGENTA = "\e[35m" MAGENTA = "\e[35m"
CYAN = "\e[36m" 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
[36, 80]
end
end
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 def test_colorize_code
# Common behaviors. Warn parser error, but do not warn compile error. # Common behaviors. Warn parser error, but do not warn compile error.
tests = { tests = {