diff options
author | tomoya ishida <[email protected]> | 2024-12-03 01:44:44 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-12-02 16:44:49 +0000 |
commit | 36aeb12aa91976e8a8872fd575fe195dbd760964 (patch) | |
tree | 7069a0d1cc958032191ff3f4ba51001d6d05040c /test | |
parent | 44ef172dbdf78ee5e0bc1c7f3ebe6e348ab54323 (diff) |
[ruby/reline] Implement buffered output to Reline::ANSI
(https://github.com/ruby/reline/pull/790)
Minimize the call of STDOUT.write
This will improve rendering performance especially when there is a busy thread `Thread.new{loop{}}`
https://github.com/ruby/reline/commit/a6fe45f5ba
Diffstat (limited to 'test')
-rw-r--r-- | test/reline/test_line_editor.rb | 5 | ||||
-rw-r--r-- | test/reline/test_macro.rb | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/test/reline/test_line_editor.rb b/test/reline/test_line_editor.rb index 256ce99241..85a814a799 100644 --- a/test/reline/test_line_editor.rb +++ b/test/reline/test_line_editor.rb @@ -61,6 +61,10 @@ class Reline::LineEditor class RenderLineDifferentialTest < Reline::TestCase class TestIO < Reline::IO + def write(string) + @output << string + end + def move_cursor_column(col) @output << "[COL_#{col}]" end @@ -76,7 +80,6 @@ class Reline::LineEditor @original_iogate = Reline::IOGate @output = StringIO.new @line_editor.instance_variable_set(:@screen_size, [24, 80]) - @line_editor.instance_variable_set(:@output, @output) Reline.send(:remove_const, :IOGate) Reline.const_set(:IOGate, TestIO.new) Reline::IOGate.instance_variable_set(:@output, @output) diff --git a/test/reline/test_macro.rb b/test/reline/test_macro.rb index 319d7b76b1..bfee280c72 100644 --- a/test/reline/test_macro.rb +++ b/test/reline/test_macro.rb @@ -6,7 +6,7 @@ class Reline::MacroTest < Reline::TestCase @config = Reline::Config.new @encoding = Reline.core.encoding @line_editor = Reline::LineEditor.new(@config) - @output = @line_editor.output = File.open(IO::NULL, "w") + @output = Reline::IOGate.output = File.open(IO::NULL, "w") end def teardown |