From 2f491ea20267b93ec6b491c26001d9f8e5bf7008 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 19 Apr 2009 13:34:51 +0000 Subject: merges r23075 from trunk into ruby_1_9_1. -- * time.c (time_cmp): negate the result of reverse comparison. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_time.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index b56fae0839..c159ce724c 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 -- cgit v1.2.3