1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/time.rb (Time.xmlschema): don't accept decimal dot

without fractional digits.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-06-13 14:08:38 +00:00
parent 2cec384adc
commit 35b7b37c95
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Jun 13 23:08:02 2008 Tanaka Akira <akr@fsij.org>
* lib/time.rb (Time.xmlschema): don't accept decimal dot
without fractional digits.
Fri Jun 13 14:24:37 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (rb_memerror): exit with EXIT_FAILURE instead of magic number.

View file

@ -353,7 +353,7 @@ class Time
(-?\d+)-(\d\d)-(\d\d)
T
(\d\d):(\d\d):(\d\d)
(\.\d*)?
(\.\d+)?
(Z|[+-]\d\d:\d\d)?
\s*\z/ix =~ date
year = $1.to_i
@ -528,6 +528,9 @@ if __FILE__ == $0
Time.httpdate("Tue, 15 Nov 1994 12:45:26 GMT"))
assert_equal(Time.utc(1999, 12, 31, 23, 59, 59),
Time.httpdate("Fri, 31 Dec 1999 23:59:59 GMT"))
assert_equal(Time.utc(2007, 12, 23, 11, 22, 33),
Time.httpdate('Sunday, 23-Dec-07 11:22:33 GMT'))
end
def test_rfc3339
@ -598,6 +601,7 @@ if __FILE__ == $0
Time.xmlschema("2000-01-12T12:13:14Z"))
assert_equal(Time.utc(2001, 4, 17, 19, 23, 17, 300000),
Time.xmlschema("2001-04-17T19:23:17.3Z"))
assert_raise(ArgumentError) { Time.xmlschema("2000-01-01T00:00:00.+00:00") }
end
def test_encode_xmlschema
@ -786,6 +790,10 @@ if __FILE__ == $0
assert_equal(t, Time.xmlschema("1998-12-31T23:00:00-01:00"))
end
def test_xmlschema_fraction
assert_equal(500000, Time.xmlschema("2000-01-01T00:00:00.5+00:00").tv_usec)
end
def test_ruby_talk_152866
t = Time::xmlschema('2005-08-30T22:48:00-07:00')
assert_equal(31, t.day)