1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/reline/test_within_pipe.rb

25 lines
598 B
Ruby
Raw Normal View History

2019-06-01 18:39:12 -04:00
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
@config = Reline.class_variable_get(:@@config)
@line_editor = Reline.class_variable_get(:@@line_editor)
end
def teardown
Reline.input = STDIN
Reline.output = STDOUT
@reader.close
@writer.close
@config.reset
end
def test_simple_input
@writer.write("abc\n")
assert_equal 'abc', Reline.readmultiline(&proc{ true })
end
end