зеркало из https://github.com/github/ruby.git
Update to ruby/spec@bfd843a
This commit is contained in:
Родитель
bbecf1eb6b
Коммит
65e8a29389
|
@ -1,15 +1,13 @@
|
|||
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
|
||||
end
|
||||
|
||||
it "is deprecated" do
|
||||
-> { Data }.should complain(/constant ::Data is deprecated/)
|
||||
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
|
||||
end
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
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
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
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
|
||||
end
|
||||
|
||||
it "is deprecated" do
|
||||
-> { Fixnum }.should complain(/constant ::Fixnum is deprecated/)
|
||||
describe "Fixnum" do
|
||||
it "is unified into Integer" do
|
||||
suppress_warning do
|
||||
Fixnum.should equal(Integer)
|
||||
end
|
||||
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
|
||||
-> { 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
|
||||
end
|
||||
|
||||
it "is deprecated" do
|
||||
-> { Bignum }.should complain(/constant ::Bignum is deprecated/)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe "Kernel#=~" do
|
|||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.6"..."3.0" do
|
||||
ruby_version_is "2.6" do
|
||||
it "is deprecated" do
|
||||
-> do
|
||||
Object.new =~ /regexp/
|
||||
|
|
|
@ -411,15 +411,17 @@ describe "Marshal.dump" do
|
|||
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
|
||||
|
|
|
@ -10,16 +10,6 @@ describe "Module#deprecate_constant" do
|
|||
@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
|
||||
|
|
|
@ -27,16 +27,20 @@ describe "Range#initialize" do
|
|||
-> { @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
|
||||
|
|
|
@ -654,7 +654,7 @@ describe "Predefined global $," do
|
|||
-> { $, = 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
|
|||
$; = 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
|
||||
|
|
|
@ -13,7 +13,7 @@ ruby_version_is ""..."2.6" do
|
|||
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/)
|
||||
|
|
Загрузка…
Ссылка в новой задаче