[ruby/reline] Close working pipes
https://github.com/ruby/reline/commit/ac519f57ea
This commit is contained in:
parent
f310c19544
commit
97302a362b
@ -280,14 +280,19 @@ class Reline::Test < Reline::TestCase
|
|||||||
assert_raise(TypeError) do
|
assert_raise(TypeError) do
|
||||||
Reline.output = "This is not a file."
|
Reline.output = "This is not a file."
|
||||||
end
|
end
|
||||||
Reline.input, to_write = IO.pipe
|
input, to_write = IO.pipe
|
||||||
to_read, Reline.output = IO.pipe
|
to_read, output = IO.pipe
|
||||||
|
Reline.input, Reline.output = input, output
|
||||||
to_write.write "a\n"
|
to_write.write "a\n"
|
||||||
result = Reline.readline
|
result = Reline.readline
|
||||||
to_write.close
|
to_write.close
|
||||||
read_text = to_read.read_nonblock(100)
|
read_text = to_read.read_nonblock(100)
|
||||||
assert_equal('a', result)
|
assert_equal('a', result)
|
||||||
refute(read_text.empty?)
|
refute(read_text.empty?)
|
||||||
|
ensure
|
||||||
|
input&.close
|
||||||
|
output&.close
|
||||||
|
to_read&.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_vi_editing_mode
|
def test_vi_editing_mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user