ruby-changes:52253
From: eregon <ko1@a...>
Date: Sun, 19 Aug 2018 05:00:17 +0900 (JST)
Subject: [ruby-changes:52253] eregon:r64455 (trunk): Accept TypeError for Socket#getnameinfo
eregon 2018-08-19 04:35:37 +0900 (Sun, 19 Aug 2018) New Revision: 64455 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64455 Log: Accept TypeError for Socket#getnameinfo * Happens when VALIDATE_SOCKLEN() actually checks the length such as on FreeBSD. Modified files: trunk/spec/ruby/library/socket/socket/getnameinfo_spec.rb Index: spec/ruby/library/socket/socket/getnameinfo_spec.rb =================================================================== --- spec/ruby/library/socket/socket/getnameinfo_spec.rb (revision 64454) +++ spec/ruby/library/socket/socket/getnameinfo_spec.rb (revision 64455) @@ -68,8 +68,10 @@ describe 'Socket.getnameinfo' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/socket/socket/getnameinfo_spec.rb#L68 @addr = Socket.sockaddr_in(80, '127.0.0.1') end - it 'raises SocketError when using an invalid String' do - lambda { Socket.getnameinfo('cats') }.should raise_error(SocketError) + it 'raises SocketError or TypeError when using an invalid String' do + lambda { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e| + [SocketError, TypeError].should include(e.class) + } end describe 'without custom flags' do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/