diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-01-18 23:35:31 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2021-01-18 23:35:50 -0800 |
commit | b2159f7c38262f5d0746a3cfb9b33ea9d62ed813 (patch) | |
tree | 2b14d6baec082a331536e27c48746b8e9bd1a914 | |
parent | 82386f21b91383ac8074561ee563cb407fee16f9 (diff) | |
download | ruby-b2159f7c38262f5d0746a3cfb9b33ea9d62ed813.tar.gz |
[ruby/irb] Stub a screen size for tests
https://github.com/ruby/irb/commit/6663057083
-rw-r--r-- | test/irb/test_color.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index d035e443a8..459802181e 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -18,6 +18,21 @@ module TestIRB MAGENTA = "\e[35m" 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 # Common behaviors. Warn parser error, but do not warn compile error. tests = { |