Sha256: c8dd5cf117815a1dfc14831c0ec8a0c86c8dbab78fad5642b0efaef4fa703542

Contents?: true

Size: 549 Bytes

Versions: 2

Compression:

Stored size: 549 Bytes

Contents

# -*- encoding: binary -*-
require 'test/unit'
$-w = true
require 'kgio'

class TestKgioAddr < Test::Unit::TestCase
  def test_tcp
    addr = ENV["TEST_HOST"] || '127.0.0.1'
    tcp = TCPServer.new(addr, 0)
    port = tcp.addr[1]
    client = Kgio::TCPSocket.new(addr, port)
    accepted = tcp.accept
    assert ! accepted.instance_eval { defined?(@kgio_addr) }
    accepted.extend Kgio::SocketMethods
    s = accepted.kgio_addr!
    assert_equal addr, s
    assert_equal addr, accepted.instance_variable_get(:@kgio_addr)
    client.close
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kgio-2.11.4 test/test_kgio_addr.rb
kgio-2.11.3 test/test_kgio_addr.rb