aboutsummaryrefslogtreecommitdiffstats
path: root/test/date/test_date.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/date/test_date.rb')
-rw-r--r--test/date/test_date.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/date/test_date.rb b/test/date/test_date.rb
index 86790e4cde..3fdf793e84 100644
--- a/test/date/test_date.rb
+++ b/test/date/test_date.rb
@@ -141,4 +141,13 @@ class TestDate < Test::Unit::TestCase
assert_instance_of(String, d.to_s)
end
+ def test_submillisecond_comparison
+ d1 = DateTime.new(2013, 12, 6, 0, 0, Rational(1, 10000))
+ d2 = DateTime.new(2013, 12, 6, 0, 0, Rational(2, 10000))
+ # d1 is 0.0001s earlier than d2
+ assert_equal(-1, d1 <=> d2)
+ assert_equal(0, d1 <=> d1)
+ assert_equal(1, d2 <=> d1)
+ end
+
end