ruby-changes:63218
From: Benoit <ko1@a...>
Date: Wed, 30 Sep 2020 20:43:42 +0900 (JST)
Subject: [ruby-changes:63218] 65e8a29389 (master): Update to ruby/spec@bfd843a
https://git.ruby-lang.org/ruby.git/commit/?id=65e8a29389 From 65e8a293892800d2201899de51d19ed7ce362bbf Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Wed, 30 Sep 2020 13:43:19 +0200 Subject: Update to ruby/spec@bfd843a diff --git a/spec/ruby/core/data/constants_spec.rb b/spec/ruby/core/data/constants_spec.rb index 18f6d42..0e47a82 100644 --- a/spec/ruby/core/data/constants_spec.rb +++ b/spec/ruby/core/data/constants_spec.rb @@ -1,15 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/data/constants_spec.rb#L1 require_relative '../../spec_helper' -ruby_version_is ""..."3.0" do - describe "Data" do - it "is a subclass of Object" do - suppress_warning do - Data.superclass.should == Object - end +describe "Data" do + it "is a subclass of Object" do + suppress_warning do + Data.superclass.should == Object end + end - it "is deprecated" do - -> { Data }.should complain(/constant ::Data is deprecated/) - end + it "is deprecated" do + -> { Data }.should complain(/constant ::Data is deprecated/) end end diff --git a/spec/ruby/core/env/index_spec.rb b/spec/ruby/core/env/index_spec.rb index a0c90f8..43875f5 100644 --- a/spec/ruby/core/env/index_spec.rb +++ b/spec/ruby/core/env/index_spec.rb @@ -1,14 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/env/index_spec.rb#L1 require_relative '../../spec_helper' require_relative 'shared/key' -ruby_version_is ""..."3.0" do - describe "ENV.index" do - it_behaves_like :env_key, :index +describe "ENV.index" do + it_behaves_like :env_key, :index - it "warns about deprecation" do - -> do - ENV.index("foo") - end.should complain(/warning: ENV.index is deprecated; use ENV.key/) - end + it "warns about deprecation" do + -> do + ENV.index("foo") + end.should complain(/warning: ENV.index is deprecated; use ENV.key/) end end diff --git a/spec/ruby/core/integer/constants_spec.rb b/spec/ruby/core/integer/constants_spec.rb index 35601f8..3b8b01e 100644 --- a/spec/ruby/core/integer/constants_spec.rb +++ b/spec/ruby/core/integer/constants_spec.rb @@ -1,27 +1,25 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/integer/constants_spec.rb#L1 require_relative '../../spec_helper' -ruby_version_is ""..."3.0" do - describe "Fixnum" do - it "is unified into Integer" do - suppress_warning do - Fixnum.should equal(Integer) - end +describe "Fixnum" do + it "is unified into Integer" do + suppress_warning do + Fixnum.should equal(Integer) end + end - it "is deprecated" do - -> { Fixnum }.should complain(/constant ::Fixnum is deprecated/) - end + it "is deprecated" do + -> { Fixnum }.should complain(/constant ::Fixnum is deprecated/) end +end - describe "Bignum" do - it "is unified into Integer" do - suppress_warning do - Bignum.should equal(Integer) - end +describe "Bignum" do + it "is unified into Integer" do + suppress_warning do + Bignum.should equal(Integer) end + end - it "is deprecated" do - -> { Bignum }.should complain(/constant ::Bignum is deprecated/) - end + it "is deprecated" do + -> { Bignum }.should complain(/constant ::Bignum is deprecated/) end end diff --git a/spec/ruby/core/kernel/match_spec.rb b/spec/ruby/core/kernel/match_spec.rb index e8ef320..6dc1eb7 100644 --- a/spec/ruby/core/kernel/match_spec.rb +++ b/spec/ruby/core/kernel/match_spec.rb @@ -14,7 +14,7 @@ describe "Kernel#=~" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/match_spec.rb#L14 end end - ruby_version_is "2.6"..."3.0" do + ruby_version_is "2.6" do it "is deprecated" do -> do Object.new =~ /regexp/ diff --git a/spec/ruby/core/marshal/dump_spec.rb b/spec/ruby/core/marshal/dump_spec.rb index 30f1b75..8d6ba24 100644 --- a/spec/ruby/core/marshal/dump_spec.rb +++ b/spec/ruby/core/marshal/dump_spec.rb @@ -411,15 +411,17 @@ describe "Marshal.dump" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/marshal/dump_spec.rb#L411 load.should == (1...2) end - it "dumps a Range with extra instance variables" do - range = (1...3) - range.instance_variable_set :@foo, 42 - dump = Marshal.dump(range) - load = Marshal.load(dump) - load.should == range - load.instance_variable_get(:@foo).should == 42 + ruby_version_is ""..."3.0" do + it "dumps a Range with extra instance variables" do + range = (1...3) + range.instance_variable_set :@foo, 42 + dump = Marshal.dump(range) + load = Marshal.load(dump) + load.should == range + load.instance_variable_get(:@foo).should == 42 + end end - end unless (1...3).frozen? # Ruby 3.0 - + end describe "with a Time" do before :each do diff --git a/spec/ruby/core/module/deprecate_constant_spec.rb b/spec/ruby/core/module/deprecate_constant_spec.rb index 6a8086b..7bcced9 100644 --- a/spec/ruby/core/module/deprecate_constant_spec.rb +++ b/spec/ruby/core/module/deprecate_constant_spec.rb @@ -10,16 +10,6 @@ describe "Module#deprecate_constant" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/deprecate_constant_spec.rb#L10 @module.private_constant :PRIVATE @module.deprecate_constant :PRIVATE @pattern = /deprecated/ - if Warning.respond_to?(:[]) - @deprecated = Warning[:deprecated] - Warning[:deprecated] = true - end - end - - after :each do - if Warning.respond_to?(:[]) - Warning[:deprecated] = @deprecated - end end describe "when accessing the deprecated module" do diff --git a/spec/ruby/core/range/initialize_spec.rb b/spec/ruby/core/range/initialize_spec.rb index d2826a5..8a6ca65 100644 --- a/spec/ruby/core/range/initialize_spec.rb +++ b/spec/ruby/core/range/initialize_spec.rb @@ -27,16 +27,20 @@ describe "Range#initialize" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/range/initialize_spec.rb#L27 -> { @range.send(:initialize, 1, 3, 5, 7, 9) }.should raise_error(ArgumentError) end - it "raises a NameError if called on an already initialized Range" do - if (0..1).frozen? # Ruby 3.0- - -> { (0..1).send(:initialize, 1, 3) }.should raise_error(FrozenError) - -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(FrozenError) - else + ruby_version_is ""..."3.0" do + it "raises a NameError if called on an already initialized Range" do -> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError) -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError) end end + ruby_version_is "3.0" do + it "raises a FrozenError if called on an already initialized Range" do + -> { (0..1).send(:initialize, 1, 3) }.should raise_error(FrozenError) + -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(FrozenError) + end + end + it "raises an ArgumentError if arguments don't respond to <=>" do o1 = Object.new o2 = Object.new diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb index cb04627..5ce4e77 100644 --- a/spec/ruby/language/predefined_spec.rb +++ b/spec/ruby/language/predefined_spec.rb @@ -654,7 +654,7 @@ describe "Predefined global $," do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/predefined_spec.rb#L654 -> { $, = Object.new }.should raise_error(TypeError) end - ruby_version_is "2.7"..."3.0" do + ruby_version_is "2.7" do it "warns if assigned non-nil" do -> { $, = "_" }.should complain(/warning: `\$,' is deprecated/) end @@ -693,7 +693,7 @@ describe "Predefined global $;" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/predefined_spec.rb#L693 $; = nil end - ruby_version_is "2.7"..."3.0" do + ruby_version_is "2.7" do it "warns if assigned non-nil" do -> { $; = "_" }.should complain(/warning: `\$;' is deprecated/) end diff --git a/spec/ruby/library/net/http/HTTPServerException_spec.rb b/spec/ruby/library/net/http/HTTPServerException_spec.rb index 6800c62..87841ab 100644 --- a/spec/ruby/library/net/http/HTTPServerException_spec.rb +++ b/spec/ruby/library/net/http/HTTPServerException_spec.rb @@ -13,7 +13,7 @@ ruby_version_is ""..."2.6" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/HTTPServerException_spec.rb#L13 end end -ruby_version_is "2.6"..."3.0" do +ruby_version_is "2.6" do describe "Net::HTTPServerException" do it "is a subclass of Net::ProtoServerError and is warned as deprecated" do -> { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/