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

ruby-changes:52248

From: eregon <ko1@a...>
Date: Sun, 19 Aug 2018 04:45:15 +0900 (JST)
Subject: [ruby-changes:52248] eregon:r64456 (trunk): Use 127.0.0.1 instead of localhost in Addrinfo specs

eregon	2018-08-19 04:35:54 +0900 (Sun, 19 Aug 2018)

  New Revision: 64456

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64456

  Log:
    Use 127.0.0.1 instead of localhost in Addrinfo specs
    
    * Solaries doesn't support Addrinfo.getaddrinfo('localhost', 80),
      but supports Addrinfo.getaddrinfo('127.0.0.1', 80).

  Modified files:
    trunk/spec/ruby/library/socket/addrinfo/foreach_spec.rb
    trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb
Index: spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb
===================================================================
--- spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb	(revision 64455)
+++ spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb	(revision 64456)
@@ -2,13 +2,11 @@ require_relative '../spec_helper' https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb#L2
 require_relative '../fixtures/classes'
 
 describe 'Addrinfo.getaddrinfo' do
-  platform_is_not :solaris do
-    it 'returns an Array of Addrinfo instances' do
-      array = Addrinfo.getaddrinfo('localhost', 80)
+  it 'returns an Array of Addrinfo instances' do
+    array = Addrinfo.getaddrinfo('127.0.0.1', 80)
 
-      array.should be_an_instance_of(Array)
-      array[0].should be_an_instance_of(Addrinfo)
-    end
+    array.should be_an_instance_of(Array)
+    array[0].should be_an_instance_of(Addrinfo)
   end
 
   SocketSpecs.each_ip_protocol do |family, ip_address|
@@ -51,9 +49,9 @@ describe 'Addrinfo.getaddrinfo' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb#L49
     end
   end
 
-  platform_is_not :solaris, :windows do
+  platform_is_not :windows do
     it 'sets the default socket type of the Addrinfo instances' do
-      array    = Addrinfo.getaddrinfo('localhost', 80)
+      array    = Addrinfo.getaddrinfo('127.0.0.1', 80)
       possible = [Socket::SOCK_STREAM, Socket::SOCK_DGRAM]
 
       possible.should include(array[0].socktype)
@@ -61,14 +59,14 @@ describe 'Addrinfo.getaddrinfo' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb#L59
   end
 
   it 'sets a custom socket type of the Addrinfo instances' do
-    array = Addrinfo.getaddrinfo('localhost', 80, nil, Socket::SOCK_DGRAM)
+    array = Addrinfo.getaddrinfo('127.0.0.1', 80, nil, Socket::SOCK_DGRAM)
 
     array[0].socktype.should == Socket::SOCK_DGRAM
   end
 
-  platform_is_not :solaris, :windows do
+  platform_is_not :windows do
     it 'sets the default socket protocol of the Addrinfo instances' do
-      array    = Addrinfo.getaddrinfo('localhost', 80)
+      array    = Addrinfo.getaddrinfo('127.0.0.1', 80)
       possible = [Socket::IPPROTO_TCP, Socket::IPPROTO_UDP]
 
       possible.should include(array[0].protocol)
@@ -77,7 +75,7 @@ describe 'Addrinfo.getaddrinfo' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb#L75
 
   platform_is_not :'solaris2.10' do # i386-solaris
     it 'sets a custom socket protocol of the Addrinfo instances' do
-      array = Addrinfo.getaddrinfo('localhost', 80, nil, nil, Socket::IPPROTO_UDP)
+      array = Addrinfo.getaddrinfo('127.0.0.1', 80, nil, nil, Socket::IPPROTO_UDP)
 
       array[0].protocol.should == Socket::IPPROTO_UDP
     end
@@ -85,8 +83,7 @@ describe 'Addrinfo.getaddrinfo' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb#L83
 
   platform_is_not :solaris do
     it 'sets the canonical name when AI_CANONNAME is given as a flag' do
-      array = Addrinfo
-        .getaddrinfo('localhost', 80, nil, nil, nil, Socket::AI_CANONNAME)
+      array = Addrinfo.getaddrinfo('localhost', 80, nil, nil, nil, Socket::AI_CANONNAME)
 
       array[0].canonname.should be_an_instance_of(String)
     end
Index: spec/ruby/library/socket/addrinfo/foreach_spec.rb
===================================================================
--- spec/ruby/library/socket/addrinfo/foreach_spec.rb	(revision 64455)
+++ spec/ruby/library/socket/addrinfo/foreach_spec.rb	(revision 64456)
@@ -2,7 +2,7 @@ require_relative '../spec_helper' https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/addrinfo/foreach_spec.rb#L2
 
 describe 'Addrinfo.foreach' do
   it 'yields Addrinfo instances to the supplied block' do
-    Addrinfo.foreach('localhost', 80) do |addr|
+    Addrinfo.foreach('127.0.0.1', 80) do |addr|
       addr.should be_an_instance_of(Addrinfo)
     end
   end

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

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