diff options
author | Benoit Daloze <[email protected]> | 2020-10-24 15:52:37 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2020-10-24 15:53:53 +0200 |
commit | 148961adcd0704d964fce920330a6301b9704c25 (patch) | |
tree | 1f1f0cb7326775788683c77f0e2cceb495d3cc95 /spec/ruby/language/singleton_class_spec.rb | |
parent | 342fbae83c2e80d1b49656bc7c689cc7fe8980ce (diff) |
Update to ruby/spec@4f59d86
Diffstat (limited to 'spec/ruby/language/singleton_class_spec.rb')
-rw-r--r-- | spec/ruby/language/singleton_class_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/language/singleton_class_spec.rb b/spec/ruby/language/singleton_class_spec.rb index df735018af..705d9f3548 100644 --- a/spec/ruby/language/singleton_class_spec.rb +++ b/spec/ruby/language/singleton_class_spec.rb @@ -157,6 +157,23 @@ describe "A constant on a singleton class" do end end +describe "Defining yield in singleton class" do + ruby_version_is "2.7"..."3.0" do + it 'emits a deprecation warning' do + code = <<~RUBY + def m + class << Object.new + yield + end + end + m { :ok } + RUBY + + -> { eval(code) }.should complain(/warning: `yield' in class syntax will not be supported from Ruby 3.0/) + end + end +end + describe "Defining instance methods on a singleton class" do before :each do @k = ClassSpecs::K.new |