mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@9be7c7e
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aeeaadaad0
commit
b53cf149ad
246 changed files with 9108 additions and 548 deletions
|
@ -1,4 +1,4 @@
|
|||
require_relative '../../../spec_helper'
|
||||
require_relative '../spec_helper'
|
||||
require_relative '../fixtures/classes'
|
||||
|
||||
option_pack = 'i*'
|
||||
|
@ -10,9 +10,11 @@ describe "Socket::Option.linger" do
|
|||
it "creates a new Socket::Option for SO_LINGER" do
|
||||
so = Socket::Option.linger(1, 10)
|
||||
so.should be_an_instance_of(Socket::Option)
|
||||
|
||||
so.family.should == Socket::Constants::AF_UNSPEC
|
||||
so.level.should == Socket::Constants::SOL_SOCKET
|
||||
so.optname.should == Socket::Constants::SO_LINGER
|
||||
|
||||
so.data.should == [1, 10].pack(option_pack)
|
||||
end
|
||||
|
||||
|
@ -53,10 +55,22 @@ describe "Socket::Option#linger" do
|
|||
lambda { so.linger }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it 'raises TypeError when called on a non SOL_SOCKET/SO_LINGER option' do
|
||||
opt = Socket::Option.int(:INET, :IP, :TTL, 4)
|
||||
|
||||
lambda { opt.linger }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
platform_is_not :windows do
|
||||
it "raises TypeError if option has not good size" do
|
||||
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)
|
||||
lambda { so.linger }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
it 'raises TypeError when called on a non linger option' do
|
||||
opt = Socket::Option.new(:INET, :SOCKET, :LINGER, '')
|
||||
|
||||
lambda { opt.linger }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue