From d39be242ba795e34c1907c4d88329b15ad2838bd Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 11 May 2020 19:51:29 +0900 Subject: [PATCH] Also use pipe for input in test --- test/reline/test_within_pipe.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/reline/test_within_pipe.rb b/test/reline/test_within_pipe.rb index 46b4465f32..fbc4c1a646 100644 --- a/test/reline/test_within_pipe.rb +++ b/test/reline/test_within_pipe.rb @@ -3,9 +3,10 @@ require_relative 'helper' class Reline::WithinPipeTest < Reline::TestCase def setup Reline.send(:test_mode) - @reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external)) - Reline.input = @reader - @output = Reline.output = File.open(IO::NULL, 'w') + @input_reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external)) + Reline.input = @input_reader + @reader, @output_writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external)) + @output = Reline.output = @output_writer @config = Reline.send(:core).config @line_editor = Reline.send(:core).line_editor end @@ -14,9 +15,10 @@ class Reline::WithinPipeTest < Reline::TestCase Reline.input = STDIN Reline.output = STDOUT Reline.point = 0 - @reader.close + @input_reader.close @writer.close - @output.close + @reader.close + @output_writer.close @config.reset end