summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-03-24 08:00:18 +0900
committergit <svn-admin@ruby-lang.org>2024-03-23 23:00:21 +0000
commit3adaba0e81c1df4827dce86c19643b48d288a56b (patch)
tree2b38b878f9a6832b9c7c1cf90ac34256a94482e7 /test
parentf46b77596d9b88e603765c0980667a86c62e2b04 (diff)
[ruby/reline] Do not send color reset sequence when GeneralIO is
used (https://github.com/ruby/reline/pull/661) https://github.com/ruby/reline/commit/3719702808
Diffstat (limited to 'test')
-rw-r--r--test/reline/test_line_editor.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/reline/test_line_editor.rb b/test/reline/test_line_editor.rb
index c552787dc7..0963d2c8fe 100644
--- a/test/reline/test_line_editor.rb
+++ b/test/reline/test_line_editor.rb
@@ -4,6 +4,18 @@ require 'stringio'
class Reline::LineEditor
class RenderLineDifferentialTest < Reline::TestCase
+ module TestIO
+ RESET_COLOR = "\e[0m"
+
+ def self.move_cursor_column(col)
+ @output << "[COL_#{col}]"
+ end
+
+ def self.erase_after_cursor
+ @output << '[ERASE]'
+ end
+ end
+
def setup
verbose, $VERBOSE = $VERBOSE, nil
@line_editor = Reline::LineEditor.new(nil, Encoding::UTF_8)
@@ -12,14 +24,8 @@ class Reline::LineEditor
@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, Object.new)
+ Reline.const_set(:IOGate, TestIO)
Reline::IOGate.instance_variable_set(:@output, @output)
- def (Reline::IOGate).move_cursor_column(col)
- @output << "[COL_#{col}]"
- end
- def (Reline::IOGate).erase_after_cursor
- @output << '[ERASE]'
- end
ensure
$VERBOSE = verbose
end