Permalink
Browse files

Add specs for Socket#socketpair on X19

  • Loading branch information...
1 parent 66c4dca commit b66bb353da8ff8edc6c0f384ad2bc75c5f7cbc4c Francesco Rodriguez committed Nov 14, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 spec/ruby/library/socket/shared/socketpair.rb
View
12 spec/ruby/library/socket/shared/socketpair.rb
@@ -8,4 +8,16 @@
s2.close
end
end
+
+ ruby_version_is "1.9" do
+ it "raises SocketError if given symbol is not a Socket constants reference" do
+ lambda { Socket.socketpair(Socket::AF_UNIX, :NO_EXIST, 0) }.should raise_error(SocketError)
+ end
+
+ it "not raises SocketError if given symbol references a Socket constant" do
+ [ :DGRAM, :RAW, :RDM, :SEQPACKET, :STREAM ].each do |socket_type|
+ lambda { Socket.socketpair(Socket::AF_UNIX, socket_type, 0) }.should_not raise_error(SocketError)
+ end
+ end
+ end
end

0 comments on commit b66bb35

Please sign in to comment.