diff options
author | aycabta <aycabta@gmail.com> | 2021-10-11 17:49:54 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-10-11 18:43:27 +0900 |
commit | 5895b4a7d9571ca970b02b68b42e39eafde86fb7 (patch) | |
tree | 0dab089598969c1651d8bb7b819c7e9945dfbc49 | |
parent | 5987bcaa2d106d40d078787ced553e237ef36891 (diff) | |
download | ruby-5895b4a7d9571ca970b02b68b42e39eafde86fb7.tar.gz |
[ruby/reline] Add I/O test
https://github.com/ruby/reline/commit/bca9b9012f
-rw-r--r-- | test/reline/test_reline.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/reline/test_reline.rb b/test/reline/test_reline.rb index 717fe08ff8..b29ef77af3 100644 --- a/test/reline/test_reline.rb +++ b/test/reline/test_reline.rb @@ -1,5 +1,6 @@ require_relative 'helper' require 'reline' +require 'stringio' class Reline::Test < Reline::TestCase class DummyCallbackObject @@ -272,18 +273,21 @@ class Reline::Test < Reline::TestCase assert_equal(5, Reline.point) end - def test_input= - # TODO + def test_set_input_and_output assert_raise(TypeError) do Reline.input = "This is not a file." end - end - - def test_output= - # TODO assert_raise(TypeError) do Reline.output = "This is not a file." end + Reline.input, to_write = IO.pipe + to_read, Reline.output = IO.pipe + to_write.write "a\n" + result = Reline.readline + to_write.close + read_text = to_read.read_nonblock(100) + assert_equal('a', result) + refute(read_text.empty?) end def test_vi_editing_mode |