-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into truffle-head
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
Showing
98 changed files
with
2,173 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class BlockingMatcher | ||
def matches?(block) | ||
started = false | ||
blocking = true | ||
|
||
thread = Thread.new do | ||
started = true | ||
block.call | ||
|
||
blocking = false | ||
end | ||
|
||
while !started and status = thread.status and status != "sleep" | ||
Thread.pass | ||
end | ||
thread.kill | ||
thread.join | ||
|
||
blocking | ||
end | ||
|
||
def failure_message | ||
['Expected the given Proc', 'to block the caller'] | ||
end | ||
|
||
def negative_failure_message | ||
['Expected the given Proc', 'to not block the caller'] | ||
end | ||
end | ||
|
||
class Object | ||
def block_caller(timeout = 0.1) | ||
BlockingMatcher.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'spec_helper' | ||
require 'mspec/expectations/expectations' | ||
require 'mspec/matchers' | ||
|
||
describe BlockingMatcher do | ||
it 'matches when a Proc blocks the caller' do | ||
BlockingMatcher.new.matches?(proc { sleep }).should == true | ||
end | ||
|
||
it 'does not match when a Proc does not block the caller' do | ||
BlockingMatcher.new.matches?(proc { 1 }).should == false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'etc' | ||
|
||
describe "Struct::Group" do | ||
platform_is_not :windows do | ||
before :all do | ||
@g = Etc.getgrgid(`id -g`.strip.to_i) | ||
end | ||
|
||
it "returns group name" do | ||
@g.name.should == `id -gn`.strip | ||
end | ||
|
||
it "returns group password" do | ||
@g.passwd.is_a?(String).should == true | ||
end | ||
|
||
it "returns group id" do | ||
@g.gid.should == `id -g`.strip.to_i | ||
end | ||
|
||
it "returns an array of users belonging to the group" do | ||
@g.mem.is_a?(Array).should == true | ||
end | ||
|
||
it "can be compared to another object" do | ||
(@g == nil).should == false | ||
(@g == Object.new).should == false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'etc' | ||
|
||
describe "Struct::Passwd" do | ||
platform_is_not :windows do | ||
before :all do | ||
@pw = Etc.getpwuid(`id -u`.strip.to_i) | ||
end | ||
|
||
it "returns user name" do | ||
@pw.name.should == `id -un`.strip | ||
end | ||
|
||
it "returns user password" do | ||
@pw.passwd.is_a?(String).should == true | ||
end | ||
|
||
it "returns user id" do | ||
@pw.uid.should == `id -u`.strip.to_i | ||
end | ||
|
||
it "returns user group id" do | ||
@pw.gid.should == `id -g`.strip.to_i | ||
end | ||
|
||
it "returns user personal information (gecos field)" do | ||
@pw.gecos.is_a?(String).should == true | ||
end | ||
|
||
it "returns user home directory" do | ||
@pw.dir.is_a?(String).should == true | ||
end | ||
|
||
it "returns user shell" do | ||
@pw.shell.is_a?(String).should == true | ||
end | ||
|
||
it "can be compared to another object" do | ||
(@pw == nil).should == false | ||
(@pw == Object.new).should == false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require File.expand_path('../fixtures/common', __FILE__) | ||
require 'find' | ||
|
||
describe "Find.find" do | ||
it "needs to be reviewed for spec completeness" | ||
|
||
before :all do | ||
FindDirSpecs.create_mock_dirs | ||
end | ||
|
||
after :all do | ||
FindDirSpecs.delete_mock_dirs | ||
end | ||
|
||
describe "when called without a block" do | ||
it "returns an Enumerator" do | ||
Find.find(FindDirSpecs.mock_dir).should be_an_instance_of(enumerator_class) | ||
Find.find(FindDirSpecs.mock_dir).to_a.sort.should == FindDirSpecs.expected_paths | ||
end | ||
end | ||
|
||
it "should recursively yield every file in the directory" do | ||
a = [] | ||
|
||
Find.find(FindDirSpecs.mock_dir) do |file| | ||
a << file | ||
end | ||
|
||
a.sort.should == FindDirSpecs.expected_paths | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
module FindDirSpecs | ||
def self.mock_dir(dirs = ['find_specs_mock']) | ||
@mock_dir ||= tmp("") | ||
File.join @mock_dir, dirs | ||
end | ||
|
||
# The names of the fixture directories and files used by | ||
# various Find specs. | ||
def self.mock_dir_files | ||
unless @mock_dir_files | ||
@mock_dir_files = %w[ | ||
.dotfile | ||
.dotsubdir/.dotfile | ||
.dotsubdir/nondotfile | ||
|
||
deeply/.dotfile | ||
deeply/nested/.dotfile.ext | ||
deeply/nested/directory/structure/.ext | ||
deeply/nested/directory/structure/bar | ||
deeply/nested/directory/structure/baz | ||
deeply/nested/directory/structure/file_one | ||
deeply/nested/directory/structure/file_one.ext | ||
deeply/nested/directory/structure/foo | ||
deeply/nondotfile | ||
|
||
file_one.ext | ||
file_two.ext | ||
|
||
dir_filename_ordering | ||
dir/filename_ordering | ||
|
||
nondotfile | ||
|
||
subdir_one/.dotfile | ||
subdir_one/nondotfile | ||
subdir_two/nondotfile | ||
subdir_two/nondotfile.ext | ||
|
||
brace/a | ||
brace/a.js | ||
brace/a.erb | ||
brace/a.js.rjs | ||
brace/a.html.erb | ||
|
||
special/+ | ||
|
||
special/^ | ||
special/$ | ||
|
||
special/( | ||
special/) | ||
special/[ | ||
special/] | ||
special/{ | ||
special/} | ||
|
||
special/test{1}/file[1] | ||
] | ||
|
||
platform_is_not :windows do | ||
@mock_dir_files += %w[ | ||
special/* | ||
special/? | ||
|
||
special/| | ||
] | ||
end | ||
end | ||
|
||
@mock_dir_files | ||
end | ||
|
||
def self.create_mock_dirs | ||
umask = File.umask 0 | ||
mock_dir_files.each do |name| | ||
file = File.join mock_dir, name | ||
mkdir_p File.dirname(file) | ||
touch file | ||
end | ||
File.umask umask | ||
end | ||
|
||
def self.delete_mock_dirs | ||
rm_r mock_dir | ||
end | ||
|
||
def self.expected_paths | ||
unless @expected_paths | ||
@expected_paths = %w[ | ||
.dotfile | ||
|
||
.dotsubdir | ||
.dotsubdir/.dotfile | ||
.dotsubdir/nondotfile | ||
|
||
deeply | ||
deeply/.dotfile | ||
|
||
deeply/nested | ||
deeply/nested/.dotfile.ext | ||
|
||
deeply/nested/directory | ||
|
||
deeply/nested/directory/structure | ||
deeply/nested/directory/structure/.ext | ||
deeply/nested/directory/structure/bar | ||
deeply/nested/directory/structure/baz | ||
deeply/nested/directory/structure/file_one | ||
deeply/nested/directory/structure/file_one.ext | ||
deeply/nested/directory/structure/foo | ||
deeply/nondotfile | ||
|
||
file_one.ext | ||
file_two.ext | ||
|
||
dir_filename_ordering | ||
|
||
dir | ||
dir/filename_ordering | ||
|
||
nondotfile | ||
|
||
subdir_one | ||
subdir_one/.dotfile | ||
subdir_one/nondotfile | ||
|
||
subdir_two | ||
subdir_two/nondotfile | ||
subdir_two/nondotfile.ext | ||
|
||
brace | ||
brace/a | ||
brace/a.js | ||
brace/a.erb | ||
brace/a.js.rjs | ||
brace/a.html.erb | ||
|
||
special | ||
special/+ | ||
|
||
special/^ | ||
special/$ | ||
|
||
special/( | ||
special/) | ||
special/[ | ||
special/] | ||
special/{ | ||
special/} | ||
|
||
special/test{1} | ||
special/test{1}/file[1] | ||
] | ||
|
||
platform_is_not :windows do | ||
@expected_paths += %w[ | ||
special/* | ||
special/? | ||
|
||
special/| | ||
] | ||
end | ||
|
||
@expected_paths.map! do |file| | ||
File.join(mock_dir, file) | ||
end | ||
|
||
@expected_paths << mock_dir | ||
@expected_paths.sort! | ||
end | ||
|
||
@expected_paths | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'find' | ||
|
||
describe "Find.prune" do | ||
it "should throw :prune" do | ||
msg = catch(:prune) do | ||
Find.prune | ||
end | ||
|
||
msg.should == nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'matrix' | ||
|
||
describe "Vector#cross_product" do | ||
it "returns the cross product of a vector" do | ||
Vector[1, 2, 3].cross_product(Vector[0, -4, 5]).should == Vector[22, -5, -4] | ||
end | ||
|
||
it "raises an error unless both vectors have dimension 3" do | ||
lambda { | ||
Vector[1, 2, 3].cross_product(Vector[0, -4]) | ||
}.should raise_error(Vector::ErrDimensionMismatch) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'pathname' | ||
|
||
describe "Pathname#realdirpath" do | ||
|
||
it "returns a Pathname" do | ||
Pathname.pwd.realdirpath.should be_an_instance_of(Pathname) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'pathname' | ||
|
||
describe "Pathname#realpath" do | ||
|
||
it "returns a Pathname" do | ||
Pathname.pwd.realpath.should be_an_instance_of(Pathname) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#afamily" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns Socket::AF_INET" do | ||
@addrinfo.afamily.should == Socket::AF_INET | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns Socket::AF_INET6" do | ||
@addrinfo.afamily.should == Socket::AF_INET6 | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns Socket::AF_UNIX" do | ||
@addrinfo.afamily.should == Socket::AF_UNIX | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#bind" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", SocketSpecs.port) | ||
end | ||
|
||
after :each do | ||
@socket.close unless @socket.closed? | ||
end | ||
|
||
it "returns a bound socket when no block is given" do | ||
@socket = @addrinfo.bind | ||
@socket.should be_kind_of(Socket) | ||
@socket.closed?.should be_false | ||
end | ||
|
||
it "yields the socket if a block is given" do | ||
@addrinfo.bind do |sock| | ||
@socket = sock | ||
sock.should be_kind_of(Socket) | ||
end | ||
@socket.closed?.should be_true | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#canonname" do | ||
|
||
before :each do | ||
@addrinfos = Addrinfo.getaddrinfo("localhost", 80, :INET, :STREAM, nil, Socket::AI_CANONNAME) | ||
end | ||
|
||
it "returns the canonical name for a host" do | ||
canonname = @addrinfos.map { |a| a.canonname }.find { |name| name and name.include?("localhost") } | ||
canonname.should include("localhost") | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#initialize" do | ||
|
||
describe "with a sockaddr string" do | ||
|
||
describe "without a family" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(Socket.sockaddr_in("smtp", "2001:DB8::1")) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "2001:db8::1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 25 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_UNSPEC | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET6 | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == 0 | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family given" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(Socket.sockaddr_in("smtp", "2001:DB8::1"), Socket::PF_INET6) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "2001:db8::1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 25 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET6 | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET6 | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == 0 | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family and socket type" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(Socket.sockaddr_in("smtp", "2001:DB8::1"), Socket::PF_INET6, Socket::SOCK_STREAM) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "2001:db8::1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 25 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET6 | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET6 | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family, socket type and protocol" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(Socket.sockaddr_in("smtp", "2001:DB8::1"), Socket::PF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "2001:db8::1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 25 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET6 | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET6 | ||
end | ||
|
||
it "returns the specified socket type" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
|
||
it "returns the specified protocol" do | ||
@addrinfo.protocol.should == Socket::IPPROTO_TCP | ||
end | ||
end | ||
|
||
end | ||
|
||
describe "with a sockaddr array" do | ||
|
||
describe "without a family" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(["AF_INET", 46102, "localhost", "127.0.0.1"]) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "127.0.0.1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 46102 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == 0 | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family given" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(["AF_INET", 46102, "localhost", "127.0.0.1"], Socket::PF_INET) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "127.0.0.1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 46102 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == 0 | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family and socket type" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(["AF_INET", 46102, "localhost", "127.0.0.1"], Socket::PF_INET, Socket::SOCK_STREAM) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "127.0.0.1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 46102 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
|
||
it "returns the 0 protocol" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
|
||
describe "with a family, socket type and protocol" do | ||
before :each do | ||
@addrinfo = Addrinfo.new(["AF_INET", 46102, "localhost", "127.0.0.1"], Socket::PF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP) | ||
end | ||
|
||
it "stores the ip address from the sockaddr" do | ||
@addrinfo.ip_address.should == "127.0.0.1" | ||
end | ||
|
||
it "stores the port number from the sockaddr" do | ||
@addrinfo.ip_port.should == 46102 | ||
end | ||
|
||
it "returns the Socket::UNSPEC pfamily" do | ||
@addrinfo.pfamily.should == Socket::PF_INET | ||
end | ||
|
||
it "returns the INET6 afamily" do | ||
@addrinfo.afamily.should == Socket::AF_INET | ||
end | ||
|
||
it "returns the 0 socket type" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
|
||
it "returns the specified protocol" do | ||
@addrinfo.protocol.should == Socket::IPPROTO_TCP | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ip_address" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns the ip address" do | ||
@addrinfo.ip_address.should == "127.0.0.1" | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns the ip address" do | ||
@addrinfo.ip_address.should == "::1" | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "raises an exception" do | ||
lambda { @addrinfo.ip_address }.should raise_error(SocketError) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ip_port" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns the port" do | ||
@addrinfo.ip_port.should == 80 | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns the port" do | ||
@addrinfo.ip_port.should == 80 | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "raises an exception" do | ||
lambda { @addrinfo.ip_port }.should raise_error(SocketError) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ip?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns true" do | ||
@addrinfo.ip?.should be_true | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns true" do | ||
@addrinfo.ip?.should be_true | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns Socket::AF_INET6" do | ||
@addrinfo.ip?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ip_unpack" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns the ip address and port pair" do | ||
@addrinfo.ip_unpack.should == ["127.0.0.1", 80] | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns the ip address and port pair" do | ||
@addrinfo.ip_unpack.should == ["::1", 80] | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "raises an exception" do | ||
lambda { @addrinfo.ip_unpack }.should raise_error(SocketError) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv4_loopback?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@loopback = Addrinfo.tcp("127.0.0.1", 80) | ||
@other = Addrinfo.tcp("0.0.0.0", 80) | ||
end | ||
|
||
it "returns true for the loopback address" do | ||
@loopback.ipv4_loopback?.should be_true | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv4_loopback?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@loopback = Addrinfo.tcp("::1", 80) | ||
@other = Addrinfo.tcp("::", 80) | ||
end | ||
|
||
it "returns false for the loopback address" do | ||
@loopback.ipv4_loopback?.should be_false | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv4_loopback?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv4_loopback?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv4_multicast?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@multicast = Addrinfo.tcp("224.0.0.1", 80) | ||
@other = Addrinfo.tcp("0.0.0.0", 80) | ||
end | ||
|
||
it "returns true for the loopback address" do | ||
@multicast.ipv4_multicast?.should be_true | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv4_multicast?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@multicast = Addrinfo.tcp("ff02::1", 80) | ||
@other = Addrinfo.tcp("::", 80) | ||
end | ||
|
||
it "returns false for the loopback address" do | ||
@multicast.ipv4_multicast?.should be_false | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv4_multicast?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv4_multicast?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv4_private?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@private = Addrinfo.tcp("10.0.0.1", 80) | ||
@other = Addrinfo.tcp("0.0.0.0", 80) | ||
end | ||
|
||
it "returns true for a private address" do | ||
@private.ipv4_private?.should be_true | ||
end | ||
|
||
it "returns false for a public address" do | ||
@other.ipv4_private?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@other = Addrinfo.tcp("::", 80) | ||
end | ||
|
||
it "returns false" do | ||
@other.ipv4_private?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv4_private?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv4?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("10.0.0.1", 80) | ||
end | ||
|
||
it "returns true" do | ||
@addrinfo.ipv4?.should be_true | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv4?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv4?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv6_loopback?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@loopback = Addrinfo.tcp("127.0.0.1", 80) | ||
@other = Addrinfo.tcp("0.0.0.0", 80) | ||
end | ||
|
||
it "returns true for the loopback address" do | ||
@loopback.ipv6_loopback?.should be_false | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv6_loopback?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@loopback = Addrinfo.tcp("::1", 80) | ||
@other = Addrinfo.tcp("::", 80) | ||
end | ||
|
||
it "returns false for the loopback address" do | ||
@loopback.ipv6_loopback?.should be_true | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv6_loopback?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv6_loopback?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv6_multicast?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@multicast = Addrinfo.tcp("224.0.0.1", 80) | ||
@other = Addrinfo.tcp("0.0.0.0", 80) | ||
end | ||
|
||
it "returns true for the loopback address" do | ||
@multicast.ipv6_multicast?.should be_false | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv6_multicast?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@multicast = Addrinfo.tcp("ff02::1", 80) | ||
@other = Addrinfo.tcp("::", 80) | ||
end | ||
|
||
it "returns false for the loopback address" do | ||
@multicast.ipv6_multicast?.should be_true | ||
end | ||
|
||
it "returns false for another address" do | ||
@other.ipv6_multicast?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv6_multicast?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#ipv6?" do | ||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("10.0.0.1", 80) | ||
end | ||
|
||
it "returns true" do | ||
@addrinfo.ipv6?.should be_false | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv6?.should be_true | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.ipv6?.should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#pfamily" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns Socket::PF_INET" do | ||
@addrinfo.pfamily.should == Socket::PF_INET | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns Socket::PF_INET6" do | ||
@addrinfo.pfamily.should == Socket::PF_INET6 | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns Socket::PF_UNIX" do | ||
@addrinfo.pfamily.should == Socket::PF_UNIX | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#protocol" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns Socket::IPPROTO_TCP" do | ||
@addrinfo.protocol.should == Socket::IPPROTO_TCP | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns Socket::IPPROTO_TCP" do | ||
@addrinfo.protocol.should == Socket::IPPROTO_TCP | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns 0" do | ||
@addrinfo.protocol.should == 0 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
describe :socket_addrinfo_to_sockaddr, :shared => true do | ||
|
||
describe "for an ipv4 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns a sockaddr packed structure" do | ||
@addrinfo.send(@method).should be_kind_of(String) | ||
end | ||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns a sockaddr packed structure" do | ||
@addrinfo.send(@method).should be_kind_of(String) | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns a sockaddr packed structure" do | ||
@addrinfo.send(@method).should be_kind_of(String) | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#socktype" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns Socket::SOCK_STREAM" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns Socket::SOCK_STREAM" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns Socket::SOCK_STREAM" do | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo.tcp" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("localhost", "smtp") | ||
end | ||
|
||
it "creates a addrinfo for a tcp socket" do | ||
["::1", "127.0.0.1"].should include(@addrinfo.ip_address) | ||
[Socket::PF_INET, Socket::PF_INET6].should include(@addrinfo.pfamily) | ||
@addrinfo.ip_port.should == 25 | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
platform_is_not :solaris do | ||
@addrinfo.protocol.should == Socket::IPPROTO_TCP | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../shared/to_sockaddr', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#to_s" do | ||
it_behaves_like(:socket_addrinfo_to_sockaddr, :to_s) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../shared/to_sockaddr', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#to_sockaddr" do | ||
it_behaves_like(:socket_addrinfo_to_sockaddr, :to_sockaddr) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo.udp" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.udp("localhost", "daytime") | ||
end | ||
|
||
it "creates a addrinfo for a tcp socket" do | ||
["::1", "127.0.0.1"].should include(@addrinfo.ip_address) | ||
[Socket::PF_INET, Socket::PF_INET6].should include(@addrinfo.pfamily) | ||
@addrinfo.ip_port.should == 13 | ||
@addrinfo.socktype.should == Socket::SOCK_DGRAM | ||
platform_is_not :solaris do | ||
@addrinfo.protocol.should == Socket::IPPROTO_UDP | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo#unix_path" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "raises an exception" do | ||
lambda { @addrinfo.unix_path }.should raise_error(SocketError) | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "raises an exception" do | ||
lambda { @addrinfo.unix_path }.should raise_error(SocketError) | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns the socket path" do | ||
@addrinfo.unix_path.should == "/tmp/sock" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require 'socket' | ||
|
||
describe "Addrinfo.unix" do | ||
|
||
platform_is_not :windows do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "creates a addrinfo for a unix socket" do | ||
@addrinfo.pfamily.should == Socket::PF_UNIX | ||
@addrinfo.socktype.should == Socket::SOCK_STREAM | ||
@addrinfo.protocol.should == 0 | ||
@addrinfo.unix_path.should == "/tmp/sock" | ||
end | ||
end | ||
end | ||
|
||
describe "Addrinfo#unix?" do | ||
describe "for an ipv4 socket" do | ||
|
||
before :each do | ||
@addrinfo = Addrinfo.tcp("127.0.0.1", 80) | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.unix?.should be_false | ||
end | ||
|
||
end | ||
|
||
describe "for an ipv6 socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.tcp("::1", 80) | ||
end | ||
|
||
it "returns false" do | ||
@addrinfo.unix?.should be_false | ||
end | ||
end | ||
|
||
platform_is_not :windows do | ||
describe "for a unix socket" do | ||
before :each do | ||
@addrinfo = Addrinfo.unix("/tmp/sock") | ||
end | ||
|
||
it "returns true" do | ||
@addrinfo.unix?.should be_true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
describe "Socket::Option.bool" do | ||
it "creates a new Socket::Option" do | ||
so = Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true) | ||
so.should be_an_instance_of(Socket::Option) | ||
so.family.should == Socket::AF_INET | ||
so.level.should == Socket::SOL_SOCKET | ||
so.optname.should == Socket::SO_KEEPALIVE | ||
so.data.should == [1].pack('i') | ||
end | ||
end | ||
|
||
describe "Socket::Option#bool" do | ||
it "returns boolean value" do | ||
Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true).bool.should == true | ||
Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false).bool.should == false | ||
end | ||
|
||
it "raises TypeError if option has not good size" do | ||
so = Socket::Option.new(:UNSPEC, :SOCKET, :SO_LINGER, [0, 0].pack('i*')) | ||
lambda { so.bool }.should raise_error(TypeError) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
require 'socket' | ||
|
||
describe 'Socket::Option#inspect' do | ||
it 'correctly returns SO_LINGER value' do | ||
value = Socket::Option.linger(nil, 0).inspect | ||
value.should == '#<Socket::Option: UNSPEC SOCKET LINGER off 0sec>' | ||
|
||
value = Socket::Option.linger(false, 30).inspect | ||
value.should == '#<Socket::Option: UNSPEC SOCKET LINGER off 30sec>' | ||
|
||
value = Socket::Option.linger(true, 0).inspect | ||
value.should == '#<Socket::Option: UNSPEC SOCKET LINGER on 0sec>' | ||
|
||
value = Socket::Option.linger(true, 30).inspect | ||
value.should == '#<Socket::Option: UNSPEC SOCKET LINGER on 30sec>' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
describe "Socket::Option.int" do | ||
it "creates a new Socket::Option" do | ||
so = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 5) | ||
so.should be_an_instance_of(Socket::Option) | ||
so.family.should == Socket::Constants::AF_INET | ||
so.level.should == Socket::Constants::SOL_SOCKET | ||
so.optname.should == Socket::Constants::SO_KEEPALIVE | ||
so.data.should == [5].pack('i') | ||
end | ||
end | ||
|
||
describe "Socket::Option#int" do | ||
it "returns int value" do | ||
so = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 17) | ||
so.int.should == 17 | ||
|
||
so = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 32765) | ||
so.int.should == 32765 | ||
end | ||
|
||
it "raises TypeError if option has not good size" do | ||
so = Socket::Option.new(:UNSPEC, :SOCKET, :SO_LINGER, [0, 0].pack('i*')) | ||
lambda { so.int }.should raise_error(TypeError) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
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('i*') | ||
end | ||
|
||
it "accepts boolean as onoff argument" do | ||
so = Socket::Option.linger(false, 0) | ||
so.data.should == [0, 0].pack('i*') | ||
|
||
so = Socket::Option.linger(true, 1) | ||
so.data.should == [1, 1].pack('i*') | ||
end | ||
end | ||
|
||
describe "Socket::Option#linger" do | ||
it "returns linger option" do | ||
so = Socket::Option.linger(0, 5) | ||
ary = so.linger | ||
ary[0].should be_false | ||
ary[1].should == 5 | ||
|
||
so = Socket::Option.linger(false, 4) | ||
ary = so.linger | ||
ary[0].should be_false | ||
ary[1].should == 4 | ||
|
||
so = Socket::Option.linger(1, 10) | ||
ary = so.linger | ||
ary[0].should be_true | ||
ary[1].should == 10 | ||
|
||
so = Socket::Option.linger(true, 9) | ||
ary = so.linger | ||
ary[0].should be_true | ||
ary[1].should == 9 | ||
end | ||
|
||
it "raises TypeError if not a SO_LINGER" do | ||
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :KEEPALIVE, 1) | ||
lambda { so.linger }.should raise_error(TypeError) | ||
end | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
describe "Socket::Option.new" do | ||
it "should accept integers" do | ||
so = Socket::Option.new(Socket::AF_INET, Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, [0].pack('i')) | ||
so.family.should == Socket::AF_INET | ||
so.level.should == Socket::SOL_SOCKET | ||
so.optname.should == Socket::SO_KEEPALIVE | ||
end | ||
|
||
it "should accept symbols" do | ||
so = Socket::Option.new(:AF_INET, :SOL_SOCKET, :SO_KEEPALIVE, [0].pack('i')) | ||
so.family.should == Socket::AF_INET | ||
so.level.should == Socket::SOL_SOCKET | ||
so.optname.should == Socket::SO_KEEPALIVE | ||
|
||
so = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [0].pack('i')) | ||
so.family.should == Socket::AF_INET | ||
so.level.should == Socket::SOL_SOCKET | ||
so.optname.should == Socket::SO_KEEPALIVE | ||
end | ||
|
||
it "should raise error on unknown family" do | ||
lambda { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) | ||
end | ||
|
||
it "should raise error on unknown level" do | ||
lambda { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) | ||
end | ||
|
||
it "should raise error on unknown option name" do | ||
lambda { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
require 'socket' | ||
|
||
describe 'TCPServer#listen' do | ||
before :each do | ||
@server = TCPServer.new(SocketSpecs.hostname, SocketSpecs.port) | ||
end | ||
|
||
after :each do | ||
@server.close unless @server.closed? | ||
end | ||
|
||
it 'returns 0' do | ||
@server.listen(10).should == 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,31 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
require 'socket' | ||
|
||
describe "TCPServer#sysaccept" do | ||
before :each do | ||
@server = TCPServer.new(SocketSpecs.hostname, SocketSpecs.port) | ||
end | ||
|
||
after :each do | ||
@server.close unless @server.closed? | ||
end | ||
|
||
it 'blocks if no connections' do | ||
lambda { @server.sysaccept }.should block_caller | ||
end | ||
|
||
it 'returns file descriptor of an accepted connection' do | ||
begin | ||
sock = TCPSocket.new(SocketSpecs.hostname, SocketSpecs.port) | ||
|
||
fd = @server.sysaccept | ||
|
||
fd.should be_an_instance_of(Fixnum) | ||
ensure | ||
sock.close if sock && !sock.closed? | ||
IO.for_fd(fd).close if fd | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require File.expand_path('../../../../spec_helper', __FILE__) | ||
require File.expand_path('../../fixtures/classes', __FILE__) | ||
|
||
describe "TCPSocket#setsockopt" do | ||
before :each do | ||
@server = SocketSpecs::SpecTCPServer.new | ||
@hostname = @server.hostname | ||
end | ||
|
||
before :each do | ||
@sock = TCPSocket.new @hostname, SocketSpecs.port | ||
end | ||
|
||
after :each do | ||
@sock.close unless @sock.closed? | ||
@server.shutdown | ||
end | ||
|
||
describe "using constants" do | ||
it "sets the TCP nodelay to 1" do | ||
@sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1).should == 0 | ||
end | ||
end | ||
|
||
describe "using symbols" do | ||
it "sets the TCP nodelay to 1" do | ||
@sock.setsockopt(:IPPROTO_TCP, :TCP_NODELAY, 1).should == 0 | ||
end | ||
|
||
context "without prefix" do | ||
it "sets the TCP nodelay to 1" do | ||
@sock.setsockopt(:TCP, :NODELAY, 1).should == 0 | ||
end | ||
end | ||
end | ||
|
||
describe "using strings" do | ||
it "sets the TCP nodelay to 1" do | ||
@sock.setsockopt('IPPROTO_TCP', 'TCP_NODELAY', 1).should == 0 | ||
end | ||
|
||
context "without prefix" do | ||
it "sets the TCP nodelay to 1" do | ||
@sock.setsockopt('TCP', 'NODELAY', 1).should == 0 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- encoding: utf-8 -*- | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'stringio' | ||
require File.expand_path('../shared/getc', __FILE__) | ||
|
||
# This method is added by io/console on require. | ||
describe "StringIO#getch" do | ||
require 'io/console' | ||
|
||
it_behaves_like :stringio_getc, :getch | ||
|
||
it "returns the charactor at the current position" do | ||
io = StringIO.new("example") | ||
|
||
io.send(@method).should == ?e | ||
io.send(@method).should == ?x | ||
io.send(@method).should == ?a | ||
end | ||
|
||
with_feature :encoding do | ||
it "increments #pos by the byte size of the character in multibyte strings" do | ||
io = StringIO.new("föóbar") | ||
|
||
io.send(@method); io.pos.should == 1 # "f" has byte size 1 | ||
io.send(@method); io.pos.should == 3 # "ö" has byte size 2 | ||
io.send(@method); io.pos.should == 5 # "ó" has byte size 2 | ||
io.send(@method); io.pos.should == 6 # "b" has byte size 1 | ||
end | ||
end | ||
|
||
it "returns nil at the end of the string" do | ||
# empty string case | ||
io = StringIO.new("") | ||
io.send(@method).should == nil | ||
io.send(@method).should == nil | ||
|
||
# non-empty string case | ||
io = StringIO.new("a") | ||
io.send(@method) # skip one | ||
io.send(@method).should == nil | ||
end | ||
|
||
describe "StringIO#getch when self is not readable" do | ||
it_behaves_like :stringio_getc_not_readable, :getch | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require "stringio" | ||
require File.expand_path('../shared/read', __FILE__) | ||
require File.expand_path('../shared/sysread', __FILE__) | ||
|
||
describe "StringIO#read_nonblock when passed length, buffer" do | ||
it_behaves_like :stringio_read, :read_nonblock | ||
end | ||
|
||
describe "StringIO#read_nonblock when passed length" do | ||
it_behaves_like :stringio_read_length, :read_nonblock | ||
end | ||
|
||
describe "StringIO#read_nonblock when passed nil" do | ||
it_behaves_like :stringio_read_nil, :read_nonblock | ||
end | ||
|
||
describe "StringIO#read_nonblock when passed length" do | ||
it_behaves_like :stringio_sysread_length, :read_nonblock | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe :stringio_sysread_length, :shared => true do | ||
before :each do | ||
@io = StringIO.new("example") | ||
end | ||
|
||
it "returns an empty String when passed 0 and no data remains" do | ||
@io.send(@method, 8).should == "example" | ||
@io.send(@method, 0).should == "" | ||
end | ||
|
||
it "raises an EOFError when passed length > 0 and no data remains" do | ||
@io.read.should == "example" | ||
lambda { @io.sysread(1) }.should raise_error(EOFError) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require File.expand_path('../fixtures/classes', __FILE__) | ||
require File.expand_path('../shared/write', __FILE__) | ||
|
||
describe "StringIO#write_nonblock when passed [Object]" do | ||
it_behaves_like :stringio_write, :write_nonblock | ||
end | ||
|
||
describe "StringIO#write_nonblock when passed [String]" do | ||
it_behaves_like :stringio_write_string, :write_nonblock | ||
end | ||
|
||
describe "StringIO#write_nonblock when self is not writable" do | ||
it_behaves_like :stringio_write_not_writable, :write_nonblock | ||
end | ||
|
||
describe "StringIO#write_nonblock when in append mode" do | ||
it_behaves_like :stringio_write_append, :write_nonblock | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'time' | ||
|
||
describe "Time#to_date" do | ||
it "yields accurate julian date for ambiguous pre-Gregorian reform value" do | ||
Time.utc(1582, 10, 4).to_date.jd.should == Date::ITALY - 11 # 2299150j | ||
end | ||
|
||
it "yields accurate julian date for Julian-Gregorian gap value" do | ||
Time.utc(1582, 10, 14).to_date.jd.should == Date::ITALY - 1 # 2299160j | ||
end | ||
|
||
it "yields accurate julian date for post-Gregorian reform value" do | ||
Time.utc(1582, 10, 15).to_date.jd.should == Date::ITALY # 2299161j | ||
end | ||
|
||
it "yields same julian day regardless of UTC time value" do | ||
Time.utc(1582, 10, 15, 00, 00, 00).to_date.jd.should == Date::ITALY | ||
Time.utc(1582, 10, 15, 23, 59, 59).to_date.jd.should == Date::ITALY | ||
end | ||
|
||
it "yields same julian day regardless of local time or zone" do | ||
|
||
with_timezone("Pacific/Pago_Pago", -11) do | ||
Time.local(1582, 10, 15, 00, 00, 00).to_date.jd.should == Date::ITALY | ||
Time.local(1582, 10, 15, 23, 59, 59).to_date.jd.should == Date::ITALY | ||
end | ||
|
||
with_timezone("Asia/Kamchatka", +12) do | ||
Time.local(1582, 10, 15, 00, 00, 00).to_date.jd.should == Date::ITALY | ||
Time.local(1582, 10, 15, 23, 59, 59).to_date.jd.should == Date::ITALY | ||
end | ||
|
||
end | ||
|
||
it "yields date with default Calendar reform day" do | ||
Time.utc(1582, 10, 4).to_date.start.should == Date::ITALY | ||
Time.utc(1582, 10, 14).to_date.start.should == Date::ITALY | ||
Time.utc(1582, 10, 15).to_date.start.should == Date::ITALY | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
require 'timeout' | ||
|
||
describe "Timeout::Error" do | ||
it "is a subclass of RuntimeError" do | ||
RuntimeError.should be_ancestor_of(Timeout::Error) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
fails:Kernel#public_send has an arity of -1 | ||
fails:Kernel#public_send raises a NoMethodError if the method is protected | ||
fails:Kernel#public_send raises a NoMethodError if the named method is an alias of a protected method | ||
fails:Kernel#public_send called from own public method raises a NoMethodError if the method is protected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#afamily for an ipv4 socket returns Socket::AF_INET | ||
fails:Addrinfo#afamily for an ipv6 socket returns Socket::AF_INET6 | ||
fails:Addrinfo#afamily for a unix socket returns Socket::AF_UNIX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Addrinfo#bind returns a bound socket when no block is given | ||
fails:Addrinfo#bind yields the socket if a block is given |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Addrinfo#canonname returns the canonical name for a host |
48 changes: 48 additions & 0 deletions
48
spec/truffle/tags/library/socket/addrinfo/initialize_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
fails:Addrinfo#initialize with a sockaddr string without a family stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string without a family stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string without a family returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr string without a family returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr string without a family returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr string without a family returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr string with a family given stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family given stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family given returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family given returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family given returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr string with a family given returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the specified socket type | ||
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the specified protocol | ||
fails:Addrinfo#initialize with a sockaddr array without a family stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array without a family stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array without a family returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr array without a family returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr array without a family returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr array without a family returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr array with a family given stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family given stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family given returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family given returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family given returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr array with a family given returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the 0 protocol | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol stores the ip address from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol stores the port number from the sockaddr | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the Socket::UNSPEC pfamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the INET6 afamily | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the 0 socket type | ||
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the specified protocol |
3 changes: 3 additions & 0 deletions
3
spec/truffle/tags/library/socket/addrinfo/ip_address_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ip_address for an ipv4 socket returns the ip address | ||
fails:Addrinfo#ip_address for an ipv6 socket returns the ip address | ||
fails:Addrinfo#ip_address for a unix socket raises an exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ip_port for an ipv4 socket returns the port | ||
fails:Addrinfo#ip_port for an ipv6 socket returns the port | ||
fails:Addrinfo#ip_port for a unix socket raises an exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ip? for an ipv4 socket returns true | ||
fails:Addrinfo#ip? for an ipv6 socket returns true | ||
fails:Addrinfo#ip? for a unix socket returns Socket::AF_INET6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ip_unpack for an ipv4 socket returns the ip address and port pair | ||
fails:Addrinfo#ip_unpack for an ipv6 socket returns the ip address and port pair | ||
fails:Addrinfo#ip_unpack for a unix socket raises an exception |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/library/socket/addrinfo/ipv4_loopback_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:Addrinfo#ipv4_loopback? for an ipv4 socket returns true for the loopback address | ||
fails:Addrinfo#ipv4_loopback? for an ipv4 socket returns false for another address | ||
fails:Addrinfo#ipv4_loopback? for an ipv6 socket returns false for the loopback address | ||
fails:Addrinfo#ipv4_loopback? for an ipv6 socket returns false for another address | ||
fails:Addrinfo#ipv4_loopback? for a unix socket returns false |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/library/socket/addrinfo/ipv4_multicast_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:Addrinfo#ipv4_multicast? for an ipv4 socket returns true for the loopback address | ||
fails:Addrinfo#ipv4_multicast? for an ipv4 socket returns false for another address | ||
fails:Addrinfo#ipv4_multicast? for an ipv6 socket returns false for the loopback address | ||
fails:Addrinfo#ipv4_multicast? for an ipv6 socket returns false for another address | ||
fails:Addrinfo#ipv4_multicast? for a unix socket returns false |
4 changes: 4 additions & 0 deletions
4
spec/truffle/tags/library/socket/addrinfo/ipv4_private_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fails:Addrinfo#ipv4_private? for an ipv4 socket returns true for a private address | ||
fails:Addrinfo#ipv4_private? for an ipv4 socket returns false for a public address | ||
fails:Addrinfo#ipv4_private? for an ipv6 socket returns false | ||
fails:Addrinfo#ipv4_private? for a unix socket returns false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ipv4? for an ipv4 socket returns true | ||
fails:Addrinfo#ipv4? for an ipv6 socket returns false | ||
fails:Addrinfo#ipv4? for a unix socket returns false |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/library/socket/addrinfo/ipv6_loopback_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:Addrinfo#ipv6_loopback? for an ipv4 socket returns true for the loopback address | ||
fails:Addrinfo#ipv6_loopback? for an ipv4 socket returns false for another address | ||
fails:Addrinfo#ipv6_loopback? for an ipv6 socket returns false for the loopback address | ||
fails:Addrinfo#ipv6_loopback? for an ipv6 socket returns false for another address | ||
fails:Addrinfo#ipv6_loopback? for a unix socket returns false |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/library/socket/addrinfo/ipv6_multicast_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:Addrinfo#ipv6_multicast? for an ipv4 socket returns true for the loopback address | ||
fails:Addrinfo#ipv6_multicast? for an ipv4 socket returns false for another address | ||
fails:Addrinfo#ipv6_multicast? for an ipv6 socket returns false for the loopback address | ||
fails:Addrinfo#ipv6_multicast? for an ipv6 socket returns false for another address | ||
fails:Addrinfo#ipv6_multicast? for a unix socket returns false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#ipv6? for an ipv4 socket returns true | ||
fails:Addrinfo#ipv6? for an ipv6 socket returns false | ||
fails:Addrinfo#ipv6? for a unix socket returns false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#pfamily for an ipv4 socket returns Socket::PF_INET | ||
fails:Addrinfo#pfamily for an ipv6 socket returns Socket::PF_INET6 | ||
fails:Addrinfo#pfamily for a unix socket returns Socket::PF_UNIX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#protocol for an ipv4 socket returns Socket::IPPROTO_TCP | ||
fails:Addrinfo#protocol for an ipv6 socket returns Socket::IPPROTO_TCP | ||
fails:Addrinfo#protocol for a unix socket returns 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#socktype for an ipv4 socket returns Socket::SOCK_STREAM | ||
fails:Addrinfo#socktype for an ipv6 socket returns Socket::SOCK_STREAM | ||
fails:Addrinfo#socktype for a unix socket returns Socket::SOCK_STREAM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Addrinfo.tcp creates a addrinfo for a tcp socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#to_s for an ipv4 socket returns a sockaddr packed structure | ||
fails:Addrinfo#to_s for an ipv6 socket returns a sockaddr packed structure | ||
fails:Addrinfo#to_s for a unix socket returns a sockaddr packed structure |
3 changes: 3 additions & 0 deletions
3
spec/truffle/tags/library/socket/addrinfo/to_sockaddr_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#to_sockaddr for an ipv4 socket returns a sockaddr packed structure | ||
fails:Addrinfo#to_sockaddr for an ipv6 socket returns a sockaddr packed structure | ||
fails:Addrinfo#to_sockaddr for a unix socket returns a sockaddr packed structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Addrinfo.udp creates a addrinfo for a tcp socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Addrinfo#unix_path for an ipv4 socket raises an exception | ||
fails:Addrinfo#unix_path for an ipv6 socket raises an exception | ||
fails:Addrinfo#unix_path for a unix socket returns the socket path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fails:Addrinfo.unix creates a addrinfo for a unix socket | ||
fails:Addrinfo#unix? for an ipv4 socket returns false | ||
fails:Addrinfo#unix? for an ipv6 socket returns false | ||
fails:Addrinfo#unix? for a unix socket returns true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Socket::Option#bool returns boolean value | ||
fails:Socket::Option#bool raises TypeError if option has not good size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Socket::Option#inspect correctly returns SO_LINGER value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Socket::Option#int returns int value | ||
fails:Socket::Option#int raises TypeError if option has not good size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Socket::Option.linger creates a new Socket::Option for SO_LINGER | ||
fails:Socket::Option.linger accepts boolean as onoff argument | ||
fails:Socket::Option#linger returns linger option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Socket::Option.new should raise error on unknown level |
1 change: 1 addition & 0 deletions
1
spec/truffle/tags/library/socket/socket/connect_nonblock_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
fails:Socket#connect_nonblock connects the socket to the remote side | ||
fails:Socket#connect_nonblock raises Errno::EINPROGRESS when the connect would block | ||
fails:Socket#connect_nonblock raises Errno::EINPROGRESS with IO::WaitWritable mixed in when the connect would block | ||
fails:Socket#connect_nonblock returns :wait_writable in exceptionless mode when the connect would block |
2 changes: 2 additions & 0 deletions
2
spec/truffle/tags/library/socket/tcpserver/accept_nonblock_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
fails:Socket::TCPServer.accept_nonblock accepts non blocking connections | ||
fails:Socket::TCPServer.accept_nonblock raises an IOError if the socket is closed | ||
fails:Socket::TCPServer.accept_nonblock without a connected client raises error | ||
fails:Socket::TCPServer.accept_nonblock without a connected client returns :wait_readable in exceptionless mode |
2 changes: 2 additions & 0 deletions
2
spec/truffle/tags/library/socket/tcpserver/sysaccept_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:TCPServer#sysaccept blocks if no connections | ||
fails:TCPServer#sysaccept returns file descriptor of an accepted connection |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/library/socket/tcpsocket/setsockopt_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:TCPSocket#setsockopt using constants sets the TCP nodelay to 1 | ||
fails:TCPSocket#setsockopt using symbols sets the TCP nodelay to 1 | ||
fails:TCPSocket#setsockopt using symbols without prefix sets the TCP nodelay to 1 | ||
fails:TCPSocket#setsockopt using strings sets the TCP nodelay to 1 | ||
fails:TCPSocket#setsockopt using strings without prefix sets the TCP nodelay to 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fails:StringIO#getch increases self's position by one | ||
fails:StringIO#getch returns nil when called at the end of self | ||
fails:StringIO#getch does not increase self's position when called at the end of file | ||
fails:StringIO#getch returns the charactor at the current position | ||
fails:StringIO#getch increments #pos by the byte size of the character in multibyte strings | ||
fails:StringIO#getch returns nil at the end of the string | ||
fails:StringIO#getch StringIO#getch when self is not readable raises an IOError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:StringIO#sysread when passed nil returns an empty String if at EOF |