1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-10-24 15:52:37 +02:00
parent 342fbae83c
commit 148961adcd
47 changed files with 725 additions and 61 deletions

View file

@ -285,6 +285,16 @@ describe "A class definition extending an object (sclass)" do
}.should raise_error(TypeError)
end
it "raises a TypeError when trying to extend non-Class" do
error_msg = /superclass must be a Class/
-> { class TestClass < ""; end }.should raise_error(TypeError, error_msg)
-> { class TestClass < 1; end }.should raise_error(TypeError, error_msg)
-> { class TestClass < :symbol; end }.should raise_error(TypeError, error_msg)
-> { class TestClass < mock('o'); end }.should raise_error(TypeError, error_msg)
-> { class TestClass < Module.new; end }.should raise_error(TypeError, error_msg)
-> { class TestClass < BasicObject.new; end }.should raise_error(TypeError, error_msg)
end
ruby_version_is ""..."3.0" do
it "allows accessing the block of the original scope" do
suppress_warning do