Sha256: dcc2f6158d6b5468b061d9635520ba9072a17ec974f48bed854a9767e70a6d72

Contents?: true

Size: 552 Bytes

Versions: 4

Compression:

Stored size: 552 Bytes

Contents

require File.expand_path('../../fixtures/classes', __FILE__)
require 'socket'

describe "Socket#unpack_sockaddr_in" do

  it "decodes the host name and port number of a packed sockaddr_in" do
    sockaddr = Socket.sockaddr_in SocketSpecs.port, '127.0.0.1'
    Socket.unpack_sockaddr_in(sockaddr).should == [SocketSpecs.port, '127.0.0.1']
  end

  it "raises an ArgumentError when the sin_family is not AF_INET" do
    sockaddr = Socket.sockaddr_un '/tmp/x'
    lambda { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysl-socket-1.0.1 spec/socket/unpack_sockaddr_in_spec.rb
rubysl-socket-2.0.1 spec/socket/unpack_sockaddr_in_spec.rb
rubysl-socket-1.0.0 spec/socket/unpack_sockaddr_in_spec.rb
rubysl-socket-2.0.0 spec/socket/unpack_sockaddr_in_spec.rb