From ae5dffd66652752e3a7dfb3a6befa1df6cac7c74 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 7 Oct 2021 18:34:29 +0900 Subject: [PATCH] Followed up bd6e1a0f0883dba7b02f30cefe5ebec96d02cb90 --- spec/ruby/library/ipaddr/new_spec.rb | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/spec/ruby/library/ipaddr/new_spec.rb b/spec/ruby/library/ipaddr/new_spec.rb index 3148d6e39c..053928c3cf 100644 --- a/spec/ruby/library/ipaddr/new_spec.rb +++ b/spec/ruby/library/ipaddr/new_spec.rb @@ -77,17 +77,34 @@ describe "IPAddr#new" do a.family.should == Socket::AF_INET6 end - it "raises on incorrect IPAddr strings" do - [ - ["fe80::1%fxp0"], - ["::1/255.255.255.0"], - [IPAddr.new("::1").to_i], - ["::ffff:192.168.1.2/120", Socket::AF_INET], - ["[192.168.1.2]/120"], - ].each { |args| - ->{ - IPAddr.new(*args) - }.should raise_error(ArgumentError) - } + ruby_version_is ""..."3.1" do + it "raises on incorrect IPAddr strings" do + [ + ["fe80::1%fxp0"], + ["::1/255.255.255.0"], + [IPAddr.new("::1").to_i], + ["::ffff:192.168.1.2/120", Socket::AF_INET], + ["[192.168.1.2]/120"], + ].each { |args| + ->{ + IPAddr.new(*args) + }.should raise_error(ArgumentError) + } + end + end + + ruby_version_is "3.1" do + it "raises on incorrect IPAddr strings" do + [ + ["::1/255.255.255.0"], + [IPAddr.new("::1").to_i], + ["::ffff:192.168.1.2/120", Socket::AF_INET], + ["[192.168.1.2]/120"], + ].each { |args| + ->{ + IPAddr.new(*args) + }.should raise_error(ArgumentError) + } + end end end