mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Also use pipe for input in test
This commit is contained in:
parent
42abad2464
commit
d39be242ba
1 changed files with 7 additions and 5 deletions
|
@ -3,9 +3,10 @@ require_relative 'helper'
|
||||||
class Reline::WithinPipeTest < Reline::TestCase
|
class Reline::WithinPipeTest < Reline::TestCase
|
||||||
def setup
|
def setup
|
||||||
Reline.send(:test_mode)
|
Reline.send(:test_mode)
|
||||||
@reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external))
|
@input_reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external))
|
||||||
Reline.input = @reader
|
Reline.input = @input_reader
|
||||||
@output = Reline.output = File.open(IO::NULL, 'w')
|
@reader, @output_writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external))
|
||||||
|
@output = Reline.output = @output_writer
|
||||||
@config = Reline.send(:core).config
|
@config = Reline.send(:core).config
|
||||||
@line_editor = Reline.send(:core).line_editor
|
@line_editor = Reline.send(:core).line_editor
|
||||||
end
|
end
|
||||||
|
@ -14,9 +15,10 @@ class Reline::WithinPipeTest < Reline::TestCase
|
||||||
Reline.input = STDIN
|
Reline.input = STDIN
|
||||||
Reline.output = STDOUT
|
Reline.output = STDOUT
|
||||||
Reline.point = 0
|
Reline.point = 0
|
||||||
@reader.close
|
@input_reader.close
|
||||||
@writer.close
|
@writer.close
|
||||||
@output.close
|
@reader.close
|
||||||
|
@output_writer.close
|
||||||
@config.reset
|
@config.reset
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue