aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_time.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_time.rb')
-rw-r--r--test/ruby/test_time.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index d89a093303..50ac569c4e 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -1109,11 +1109,14 @@ class TestTime < Test::Unit::TestCase
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