summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorMSP-Greg <Greg.mpls@gmail.com>2020-11-17 08:24:34 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-11-18 08:13:10 +0900
commit64926d500782cadf578724c3d1e7f59e7aaf200f (patch)
treeb9573b48acde3d1c7470858b9583bcbe60f869d0 /test/net
parent2ef3b979bd2916d8a1b4687290a2e65d5e495d6b (diff)
test/net/smtp - use TCPSocket when UNIXSocket unavailable
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3778
Diffstat (limited to 'test/net')
-rw-r--r--test/net/smtp/test_sslcontext.rb5
-rw-r--r--test/net/smtp/test_starttls.rb5
2 files changed, 6 insertions, 4 deletions
diff --git a/test/net/smtp/test_sslcontext.rb b/test/net/smtp/test_sslcontext.rb
index 80afc1338e..dd741cf396 100644
--- a/test/net/smtp/test_sslcontext.rb
+++ b/test/net/smtp/test_sslcontext.rb
@@ -39,7 +39,8 @@ module Net
end
def start_smtpd(starttls)
- @server_socket, @client_socket = UNIXSocket.pair
+ @server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
+ UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
@starttls_executed = false
@server_thread = Thread.new(@server_socket) do |s|
s.puts "220 fakeserver\r\n"
@@ -125,4 +126,4 @@ module Net
end
end
-end unless /mswin|mingw/ =~ RUBY_PLATFORM
+end
diff --git a/test/net/smtp/test_starttls.rb b/test/net/smtp/test_starttls.rb
index 2c812aea67..a0855b915e 100644
--- a/test/net/smtp/test_starttls.rb
+++ b/test/net/smtp/test_starttls.rb
@@ -25,7 +25,8 @@ module Net
end
def start_smtpd(starttls)
- @server_socket, @client_socket = UNIXSocket.pair
+ @server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
+ UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
@starttls_executed = false
@server_thread = Thread.new(@server_socket) do |s|
s.puts "220 fakeserver\r\n"
@@ -118,4 +119,4 @@ module Net
assert_nothing_raised { smtp.enable_starttls_auto }
end
end
-end unless /mswin|mingw/ =~ RUBY_PLATFORM
+end