diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/bootstraptest/test_objectspace.rb |
Fresh start
Diffstat (limited to 'jni/ruby/bootstraptest/test_objectspace.rb')
-rw-r--r-- | jni/ruby/bootstraptest/test_objectspace.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/jni/ruby/bootstraptest/test_objectspace.rb b/jni/ruby/bootstraptest/test_objectspace.rb new file mode 100644 index 0000000..862a94e --- /dev/null +++ b/jni/ruby/bootstraptest/test_objectspace.rb @@ -0,0 +1,46 @@ +assert_normal_exit %q{ + eval("", TOPLEVEL_BINDING) + minobj = ObjectSpace.to_enum(:each_object).min_by {|a| a.object_id } + maxobj = ObjectSpace.to_enum(:each_object).max_by {|a| a.object_id } + (((minobj.object_id-100)..(minobj.object_id+100))+ + ((maxobj.object_id-100)..(maxobj.object_id+100))).each {|id| + begin + o = ObjectSpace._id2ref(id) + rescue RangeError + next + end + o.inspect if defined?(o.inspect) + } +}, '[ruby-dev:31911]' + +assert_normal_exit %q{ + ary = (1..10).to_a + ary.permutation(2) {|x| + if x == [1,2] + ObjectSpace.each_object(String) {|s| + s.clear if !s.frozen? && (s.length == 40 || s.length == 80) + } + end + } +}, '[ruby-dev:31982]' + +assert_normal_exit %q{ + ary = (1..100).to_a + ary.permutation(2) {|x| + if x == [1,2] + ObjectSpace.each_object(Array) {|o| o.clear if o == ary && o.object_id != ary.object_id } + end + } +}, '[ruby-dev:31985]' + +assert_normal_exit %q{ + ObjectSpace.define_finalizer("") do + Mutex.new.lock + end +}, '[ruby-dev:44049]' + +assert_normal_exit %q{ + ObjectSpace.define_finalizer("") do + Thread.new {} + end +}, '[ruby-core:37858]' |