diff options
Diffstat (limited to 'test/ruby/test_time.rb')
| -rw-r--r-- | test/ruby/test_time.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 99ee84f247..b2cbd06a9f 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -152,6 +152,18 @@ class TestTime < Test::Unit::TestCase assert_raise_with_message(ArgumentError, /can't parse/) { Time.new("2020-12-02 00:00:00 ") } + assert_raise_with_message(ArgumentError, /utc_offset/) { + Time.new("2020-12-25 00:00:00 +0960") + } + assert_raise_with_message(ArgumentError, /utc_offset/) { + Time.new("2020-12-25 00:00:00 +09:60") + } + assert_raise_with_message(ArgumentError, /utc_offset/) { + Time.new("2020-12-25 00:00:00 +090060") + } + assert_raise_with_message(ArgumentError, /utc_offset/) { + Time.new("2020-12-25 00:00:00 +09:00:60") + } end def test_time_add() @@ -1409,7 +1421,7 @@ class TestTime < Test::Unit::TestCase # Time objects are common in some code, try to keep them small omit "Time object size test" if /^(?:i.?86|x86_64)-linux/ !~ RUBY_PLATFORM omit "GC is in debug" if GC::INTERNAL_CONSTANTS[:RVALUE_OVERHEAD] > 0 - omit "memsize is not accurate due to using malloc_usable_size" if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1 + omit "memsize is not accurate due to using malloc_usable_size" if GC::INTERNAL_CONSTANTS[:HEAP_COUNT] == 1 omit "Only run this test on 64-bit" if RbConfig::SIZEOF["void*"] != 8 require 'objspace' @@ -1421,7 +1433,10 @@ class TestTime < Test::Unit::TestCase RbConfig::SIZEOF["void*"] # Same size as VALUE end sizeof_vtm = RbConfig::SIZEOF["void*"] * 4 + 8 - expect = GC::INTERNAL_CONSTANTS[:BASE_SLOT_SIZE] + sizeof_timew + sizeof_vtm + data_size = GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] + sizeof_timew + sizeof_vtm + # Round up to the smallest slot size that fits + slot_sizes = GC::INTERNAL_CONSTANTS[:HEAP_COUNT].times.map { |i| GC.stat_heap(i, :slot_size) } + expect = slot_sizes.find { |s| s >= data_size } || slot_sizes.last assert_operator ObjectSpace.memsize_of(t), :<=, expect rescue LoadError => e omit "failed to load objspace: #{e.message}" |
