diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-03 14:44:20 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-04 04:01:06 +0900 |
commit | 23c92b6f820f670994026423d4c7b5abcf51eafa (patch) | |
tree | d97c74c81911109d6cb714eb775978402d58c92f /test | |
parent | 5d9e91afe08c470485333f6c6e034d05ea3ee908 (diff) | |
download | ruby-23c92b6f820f670994026423d4c7b5abcf51eafa.tar.gz |
Revert self-referencing finalizer warning [Feature #15974]
It has caused CI failures.
* d0cd0866d82a58933e5dccd073c753c0c2ad4eb5
Disable GC during rb_objspace_reachable_object_p
* 89cef1c56b3a0f9c5e6ccc22a5044477a4fd16c1
Version guard for [Feature #15974]
* 796eeb6339952d92ae1b353d450c7883e589852d.
Fix up [Feature #15974]
* 928260c2a613bbdd4402c300e0bf86ae7562e52a.
Warn in verbose mode on defining a finalizer that captures the object
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_objectspace.rb | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb index 9007e05206..c352b75b70 100644 --- a/test/ruby/test_objectspace.rb +++ b/test/ruby/test_objectspace.rb @@ -56,7 +56,7 @@ End end def test_finalizer - assert_in_out_err(["-W0", "-e", <<-END], "", %w(:ok :ok :ok :ok)) + assert_in_out_err(["-e", <<-END], "", %w(:ok :ok :ok :ok), []) a = [] ObjectSpace.define_finalizer(a) { p :ok } b = a.dup @@ -76,8 +76,8 @@ End ObjectSpace.define_finalizer([], fin) CODE end - assert_in_out_err(["-W0"], code[""], ["finalized"]) - assert_in_out_err(["-W0"], code["private "], ["finalized"]) + assert_in_out_err([], code[""], ["finalized"]) + assert_in_out_err([], code["private "], ["finalized"]) c = EnvUtil.labeled_class("C\u{3042}").new o = Object.new assert_raise_with_message(ArgumentError, /C\u{3042}/) { @@ -131,32 +131,6 @@ End END end - def test_self_referencing_finalizer - assert_separately(["-w"], "#{<<~"begin;"}\n#{<<~'end;'}") - begin; - obj = +"Test" - handler = proc {puts "finalized"} - assert_warning(/object is reachable from finalizer/) do - ObjectSpace.define_finalizer(obj, handler) - end - end; - end - - def test_indirectly_self_referencing_finalizer - assert_separately(["-w"], "#{<<~"begin;"}\n#{<<~'end;'}") - begin; - def scoped(indirect) - proc {puts "finalized"} - end - obj = +"Test" - indirect = [obj] - handler = scoped(indirect) - assert_warning(/object is reachable from finalizer/) do - ObjectSpace.define_finalizer(obj, handler) - end - end; - end - def test_each_object klass = Class.new new_obj = klass.new |