Sha256: 4fe7e8110b678df674d90fa90af47f458cff5240792bffb4f370976959c8f78b

Contents?: true

Size: 837 Bytes

Versions: 31

Compression:

Stored size: 837 Bytes

Contents

require 'test/unit'
$-w = true
require 'kgio'

class TestPeek < Test::Unit::TestCase
  class EIEIO < Errno::EIO
  end

  def teardown
    @rd.close
    @wr.close
  end

  def test_peek
    @rd, @wr = Kgio::UNIXSocket.pair
    @wr.kgio_write "HELLO"
    assert_equal "HELLO", @rd.kgio_peek(5)
    assert_equal "HELLO", @rd.kgio_trypeek(5)
    assert_equal "HELLO", @rd.kgio_read(5)
    assert_equal :wait_readable, @rd.kgio_trypeek(5)
    def @rd.kgio_wait_readable
      raise EIEIO
    end
    assert_raises(EIEIO) { @rd.kgio_peek(5) }
  end

  def test_peek_singleton
    @rd, @wr = UNIXSocket.pair
    @wr.syswrite "HELLO"
    assert_equal "HELLO", Kgio.trypeek(@rd, 666)
    assert_equal "HELLO", Kgio.trypeek(@rd, 666)
    assert_equal "HELLO", Kgio.tryread(@rd, 666)
    assert_equal :wait_readable, Kgio.trypeek(@rd, 5)
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
kgio-2.11.4 test/test_peek.rb
kgio-2.11.3 test/test_peek.rb
kgio-2.11.2 test/test_peek.rb
kgio-2.11.1.1.g36ea test/test_peek.rb
kgio-2.11.1 test/test_peek.rb
kgio-2.11.0 test/test_peek.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/kgio-2.10.0/test/test_peek.rb
kgio-2.10.0 test/test_peek.rb
kgio-2.9.3 test/test_peek.rb
kgio-2.9.2 test/test_peek.rb
kgio-2.9.1 test/test_peek.rb
kgio-2.9.0.2.gf33a test/test_peek.rb
kgio-2.9.0 test/test_peek.rb
kgio-2.8.1 test/test_peek.rb
kgio-2.8.0.2.g30c1 test/test_peek.rb
kgio-2.8.0 test/test_peek.rb
kgio-2.7.4 test/test_peek.rb
kgio-2.7.3 test/test_peek.rb
kgio-2.7.2 test/test_peek.rb
kgio-2.7.1 test/test_peek.rb