summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-26 16:35:18 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-26 16:35:18 +0000
commit8d888cf451054ca96b5cfbcee057d8d726a30ac5 (patch)
tree9374b0123dd0b232d254acdce1202e251f42f155 /test
parent82174731317b676a89a04fca1a5c5c3d57b18394 (diff)
downloadruby-8d888cf451054ca96b5cfbcee057d8d726a30ac5.tar.gz
ruby-8d888cf451054ca96b5cfbcee057d8d726a30ac5.tar.xz
ruby-8d888cf451054ca96b5cfbcee057d8d726a30ac5.zip
* time.c (time_cmp): negate the result of reverse comparison.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_time.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index b56fae083..c159ce724 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'rational'
require 'timeout'
+require 'delegate'
class TestTime < Test::Unit::TestCase
def setup
@@ -470,4 +471,13 @@ class TestTime < Test::Unit::TestCase
assert_equal("JAN", T2000.strftime("%#h"))
assert_equal("FRIDAY", Time.local(2008,1,4).strftime("%#A"))
end
+
+ def test_delegate
+ d1 = SimpleDelegator.new(t1 = Time.utc(2000))
+ d2 = SimpleDelegator.new(t2 = Time.utc(2001))
+ assert_equal(-1, t1 <=> t2)
+ assert_equal(1, t2 <=> t1)
+ assert_equal(-1, d1 <=> d2)
+ assert_equal(1, d2 <=> d1)
+ end
end