ruby-changes:56358
From: Nobuyoshi <ko1@a...>
Date: Wed, 3 Jul 2019 15:22:35 +0900 (JST)
Subject: [ruby-changes:56358] Nobuyoshi Nakada: 89cef1c56b (master): Version guard for [Feature #15974]
https://git.ruby-lang.org/ruby.git/commit/?id=89cef1c56b From 89cef1c56b3a0f9c5e6ccc22a5044477a4fd16c1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 3 Jul 2019 15:22:16 +0900 Subject: Version guard for [Feature #15974] diff --git a/spec/ruby/core/objectspace/define_finalizer_spec.rb b/spec/ruby/core/objectspace/define_finalizer_spec.rb index 3a9132e..fef7667 100644 --- a/spec/ruby/core/objectspace/define_finalizer_spec.rb +++ b/spec/ruby/core/objectspace/define_finalizer_spec.rb @@ -66,29 +66,31 @@ describe "ObjectSpace.define_finalizer" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/objectspace/define_finalizer_spec.rb#L66 ruby_exe(code).lines.sort.should == ["finalized1\n", "finalized2\n"] end - it "warns in verbose mode if it is self-referencing" do - code = <<-RUBY - obj = "Test" - handler = Proc.new { puts "finalized" } - ObjectSpace.define_finalizer(obj, handler) - exit 0 - RUBY - - ruby_exe(code, :options => "-w", :args => "2>&1").should include("warning: object is reachable from finalizer - it may never be run") - end - - it "warns in verbose mode if it is indirectly self-referencing" do - code = <<-RUBY - def scoped(indirect) - Proc.new { puts "finalized" } - end - obj = "Test" - indirect = [obj] - handler = scoped(indirect) - ObjectSpace.define_finalizer(obj, handler) - exit 0 - RUBY - - ruby_exe(code, :options => "-w", :args => "2>&1").should include("warning: object is reachable from finalizer - it may never be run") + ruby_version_is "2.7" do + it "warns in verbose mode if it is self-referencing" do + code = <<-RUBY + obj = "Test" + handler = Proc.new { puts "finalized" } + ObjectSpace.define_finalizer(obj, handler) + exit 0 + RUBY + + ruby_exe(code, :options => "-w", :args => "2>&1").should include("warning: object is reachable from finalizer - it may never be run") + end + + it "warns in verbose mode if it is indirectly self-referencing" do + code = <<-RUBY + def scoped(indirect) + Proc.new { puts "finalized" } + end + obj = "Test" + indirect = [obj] + handler = scoped(indirect) + ObjectSpace.define_finalizer(obj, handler) + exit 0 + RUBY + + ruby_exe(code, :options => "-w", :args => "2>&1").should include("warning: object is reachable from finalizer - it may never be run") + end end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/