blob: 586e782be473bd938e4f0438244f7adc9a15995b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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
|