[前][次][番号順一覧][スレッド一覧]

ruby-changes:69651

From: Peter <ko1@a...>
Date: Tue, 9 Nov 2021 05:40:08 +0900 (JST)
Subject: [ruby-changes:69651] 39d3d24abb (master): [Feature #18290] Remove tests that test use of rb_gc_force_recycle

https://git.ruby-lang.org/ruby.git/commit/?id=39d3d24abb

From 39d3d24abbd63a109ebf70c229e3a6cab927fc90 Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Mon, 8 Nov 2021 15:15:38 -0500
Subject: [Feature #18290] Remove tests that test use of rb_gc_force_recycle

Remove tests that assume objects get force recycled.
---
 test/ruby/test_io.rb      | 24 ------------------------
 test/ruby/test_sprintf.rb | 15 ---------------
 test/ruby/test_time.rb    | 16 ----------------
 3 files changed, 55 deletions(-)

diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index a90140fd0b3..96e572b98d7 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3847,30 +3847,6 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3847
       end
       end;
     end
-
-    def test_write_no_garbage
-      skip "multiple threads already active" if Thread.list.size > 1
-      res = {}
-      ObjectSpace.count_objects(res) # creates strings on first call
-      [ 'foo'.b, '*' * 24 ].each do |buf|
-        with_pipe do |r, w|
-          GC.disable
-          begin
-            before = ObjectSpace.count_objects(res)[:T_STRING]
-            n = w.write(buf)
-            s = w.syswrite(buf)
-            after = ObjectSpace.count_objects(res)[:T_STRING]
-          ensure
-            GC.enable
-          end
-          assert_equal before, after,
-            "no strings left over after write [ruby-core:78898] [Bug #13085]: #{ before } strings before write -> #{ after } strings after write"
-          assert_not_predicate buf, :frozen?, 'no inadvertent freeze'
-          assert_equal buf.bytesize, n, 'IO#write wrote expected size'
-          assert_equal s, n, 'IO#syswrite wrote expected size'
-        end
-      end
-    end
   end
 
   def test_pread
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 7986e9d141a..f2e73eb58dc 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -528,19 +528,4 @@ class TestSprintf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_sprintf.rb#L528
       sprintf("%*s", RbConfig::LIMITS["INT_MIN"], "")
     end
   end
-
-  def test_no_hidden_garbage
-    skip unless Thread.list.size == 1
-
-    fmt = [4, 2, 2].map { |x| "%0#{x}d" }.join('-') # defeats optimization
-    ObjectSpace.count_objects(res = {}) # creates strings on first call
-    GC.disable
-    before = ObjectSpace.count_objects(res)[:T_STRING]
-    val = sprintf(fmt, 1970, 1, 1)
-    after = ObjectSpace.count_objects(res)[:T_STRING]
-    assert_equal before + 1, after, 'only new string is the created one'
-    assert_equal '1970-01-01', val
-  ensure
-    GC.enable
-  end
 end
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 85667e2d1fb..702bd07094f 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -1282,22 +1282,6 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L1282
     assert_equal("366", t.strftime("%j"))
   end
 
-  def test_strftime_no_hidden_garbage
-    skip unless Thread.list.size == 1
-
-    fmt = %w(Y m d).map { |x| "%#{x}" }.join('-') # defeats optimization
-    t = Time.at(0).getutc
-    ObjectSpace.count_objects(res = {}) # creates strings on first call
-    GC.disable
-    before = ObjectSpace.count_objects(res)[:T_STRING]
-    val = t.strftime(fmt)
-    after = ObjectSpace.count_objects(res)[:T_STRING]
-    assert_equal before + 1, after, 'only new string is the created one'
-    assert_equal '1970-01-01', val
-  ensure
-    GC.enable
-  end
-
   def test_num_exact_error
     bad = EnvUtil.labeled_class("BadValue").new
     x = EnvUtil.labeled_class("Inexact") do
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]