[前][次][番号順一覧][スレッド一覧]

ruby-changes:63629

From: MSP-Greg <ko1@a...>
Date: Wed, 18 Nov 2020 08:13:35 +0900 (JST)
Subject: [ruby-changes:63629] 64926d5007 (master): test/net/smtp - use TCPSocket when UNIXSocket unavailable

https://git.ruby-lang.org/ruby.git/commit/?id=64926d5007

From 64926d500782cadf578724c3d1e7f59e7aaf200f Mon Sep 17 00:00:00 2001
From: MSP-Greg <Greg.mpls@g...>
Date: Tue, 17 Nov 2020 08:24:34 -0600
Subject: test/net/smtp - use TCPSocket when UNIXSocket unavailable


diff --git a/test/net/smtp/test_sslcontext.rb b/test/net/smtp/test_sslcontext.rb
index 80afc13..dd741cf 100644
--- a/test/net/smtp/test_sslcontext.rb
+++ b/test/net/smtp/test_sslcontext.rb
@@ -39,7 +39,8 @@ module Net https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_sslcontext.rb#L39
     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 https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_sslcontext.rb#L126
     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 2c812ae..a0855b9 100644
--- a/test/net/smtp/test_starttls.rb
+++ b/test/net/smtp/test_starttls.rb
@@ -25,7 +25,8 @@ module Net https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_starttls.rb#L25
     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 https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_starttls.rb#L119
       assert_nothing_raised { smtp.enable_starttls_auto }
     end
   end
-end unless /mswin|mingw/ =~ RUBY_PLATFORM
+end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]