Skip to content

Commit

Permalink
Add I/O test
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Oct 11, 2021
1 parent 58a7ca4 commit bca9b90
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/reline/test_reline.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative 'helper'
require 'reline'
require 'stringio'

class Reline::Test < Reline::TestCase
class DummyCallbackObject
Expand Down Expand Up @@ -272,18 +273,21 @@ def test_delete_text
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
Expand Down

0 comments on commit bca9b90

Please sign in to comment.