diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-11 11:02:24 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-11 11:02:24 +0000 |
commit | 10ce5ad1d714bafbeecb7d7f42d476a4e38cfe0d (patch) | |
tree | ddf5cdd8621ff9959e58b766523701badc49708c | |
parent | f4bbe604f4d082422bb6789cd6efb4562fc6a055 (diff) |
merges r20175 from trunk into ruby_1_9_1.
* lib/date.rb (inspect): changed the format.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/date.rb | 4 | ||||
-rw-r--r-- | test/date/test_date.rb | 3 | ||||
-rw-r--r-- | test/date/test_date_attr.rb | 4 |
4 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,7 @@ +Tue Nov 11 07:55:57 2008 Tadayoshi Funaba <tadf@dotrb.org> + + * lib/date.rb (inspect): changed the format. + Mon Nov 10 17:34:50 2008 Akinori MUSHA <knu@iDaemons.org> * test/sdbm/test_sdbm.rb (TestSDBM#test_index): Reflect the method diff --git a/lib/date.rb b/lib/date.rb index 3da3d21f8b..2c9792562b 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -1470,7 +1470,9 @@ class Date def hash() @ajd.hash end # Return internal object state as a programmer-readable string. - def inspect() format('#<%s: %s,%s,%s>', self.class, @ajd, @of, @sg) end + def inspect + format('#<%s: %s (%s,%s,%s)>', self.class, to_s, @ajd, @of, @sg) + end # Return the date as a human-readable string. # diff --git a/test/date/test_date.rb b/test/date/test_date.rb index 8cadb23420..f2be9e24c4 100644 --- a/test/date/test_date.rb +++ b/test/date/test_date.rb @@ -41,8 +41,9 @@ class TestDate < Test::Unit::TestCase assert_instance_of(DateSub, DateSub.today) assert_instance_of(DateTimeSub, DateTimeSub.now) - assert_equal('#<DateSub: -1/2,0,2299161>', d.inspect) + assert_equal('#<DateSub: -4712-01-01 (-1/2,0,2299161)>', d.inspect) assert_equal('-4712-01-01', d.to_s) + assert_equal('#<DateTimeSub: -4712-01-01T00:00:00+00:00 (-1/2,0,2299161)>', dt.inspect) assert_equal('-4712-01-01T00:00:00+00:00', dt.to_s) d2 = d + 1 diff --git a/test/date/test_date_attr.rb b/test/date/test_date_attr.rb index 2e71b5f501..5187d5d3e5 100644 --- a/test/date/test_date_attr.rb +++ b/test/date/test_date_attr.rb @@ -9,10 +9,10 @@ class TestDateAttr < Test::Unit::TestCase [date, datetime].each_with_index do |d, i| if i == 0 - assert_match(/\#<Date\d?: 4877807\/2,0,2299161>/, + assert_match(/\#<Date\d?: 1965-05-23 \(4877807\/2,0,2299161\)>/, d.inspect) else - assert_match(/\#<DateTime\d?: 210721343519\/86400,0,2299161>/, + assert_match(/\#<DateTime\d?: 1965-05-23T22:31:59\+00:00 \(210721343519\/86400,0,2299161\)>/, d.inspect) end |