From 3adaba0e81c1df4827dce86c19643b48d288a56b Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Sun, 24 Mar 2024 08:00:18 +0900 Subject: [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 --- test/reline/test_line_editor.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'test') 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 -- cgit v1.2.3