aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-07-20 21:23:18 +0200
committerMichael Koziarski <michael@koziarski.com>2008-07-20 21:23:18 +0200
commit006cbb8fde3f20a684eabcfd11c53ae762cf8435 (patch)
tree7a0cf547214e027389901d2c6aa0b770652b29f0 /activesupport
parentda85251f85420d3a906a1eb949b73bb286122ea9 (diff)
downloadrails-006cbb8fde3f20a684eabcfd11c53ae762cf8435.tar.gz
rails-006cbb8fde3f20a684eabcfd11c53ae762cf8435.tar.bz2
rails-006cbb8fde3f20a684eabcfd11c53ae762cf8435.zip
Handle the case where 64bit time_t won't overflow.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 17a0968c0e..14309f4e2d 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -528,7 +528,12 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
assert_equal Time.time_with_datetime_fallback(:utc, 2005), Time.utc(2005)
assert_equal Time.time_with_datetime_fallback(:utc, 2039), DateTime.civil(2039, 1, 1, 0, 0, 0, 0, 0)
assert_equal Time.time_with_datetime_fallback(:utc, 2005, 2, 21, 17, 44, 30, 1), Time.utc(2005, 2, 21, 17, 44, 30, 1) #with usec
- assert_equal Time.time_with_datetime_fallback(:utc, 2039, 2, 21, 17, 44, 30, 1), DateTime.civil(2039, 2, 21, 17, 44, 30, 0, 0)
+ # This won't overflow on 64bit linux
+ expected_to_overflow = Time.time_with_datetime_fallback(:utc, 2039, 2, 21, 17, 44, 30, 1)
+ unless expected_to_overflow.is_a?(Time)
+ assert_equal Time.time_with_datetime_fallback(:utc, 2039, 2, 21, 17, 44, 30, 1),
+ DateTime.civil(2039, 2, 21, 17, 44, 30, 0, 0)
+ end
assert_equal ::Date::ITALY, Time.time_with_datetime_fallback(:utc, 2039, 2, 21, 17, 44, 30, 1).start # use Ruby's default start value
end