mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/date.rb (inspect): changed the format.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd93c80482
commit
e8c67503ea
4 changed files with 11 additions and 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
|
||||
|
|
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue