diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-16 23:22:13 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-16 23:22:13 +0000 |
commit | abb00bef14f0b10f0e74b7b470dd029ab29f63c1 (patch) | |
tree | aaad53671c6201b41ae84342549bcef6256d0981 | |
parent | 60455a9010788115e25a43df3e3318a11204e98d (diff) | |
download | ruby-abb00bef14f0b10f0e74b7b470dd029ab29f63c1.tar.gz ruby-abb00bef14f0b10f0e74b7b470dd029ab29f63c1.tar.xz ruby-abb00bef14f0b10f0e74b7b470dd029ab29f63c1.zip |
* lib/date/format.rb (strptime): removed \v; since \s includes \v.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/date/format.rb | 6 | ||||
-rw-r--r-- | test/date/test_date_parse.rb | 15 |
3 files changed, 22 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Mon Aug 17 08:19:03 2009 Tadayoshi Funaba <tadf@dotrb.org> + + * lib/date/format.rb (strptime): removed \v; since \s includes \v. + Mon Aug 17 08:14:26 2009 Tadayoshi Funaba <tadf@dotrb.org> * complex.c (nucomp_rationalize) added. [experimental] diff --git a/lib/date/format.rb b/lib/date/format.rb index a83b29802..b30cf3a41 100644 --- a/lib/date/format.rb +++ b/lib/date/format.rb @@ -1,4 +1,4 @@ -# format.rb: Written by Tadayoshi Funaba 1999-2008 +# format.rb: Written by Tadayoshi Funaba 1999-2009 # $Id: format.rb,v 2.43 2008-01-17 20:16:31+09 tadf Exp $ class Date @@ -560,8 +560,8 @@ class Date end else case c - when /\A[\s\v]/ - str.sub!(/\A[\s\v]+/, '') + when /\A\s/ + str.sub!(/\A\s+/, '') else return unless str.sub!(Regexp.new('\\A' + Regexp.quote(a)), '') end diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb index 959a6e5d9..c7a9a10cc 100644 --- a/test/date/test_date_parse.rb +++ b/test/date/test_date_parse.rb @@ -639,6 +639,21 @@ class TestDateParse < Test::Unit::TestCase assert_equal(d, DateTime.parse(d.to_s)) end + def test_parse_utf8 + h = DateTime._parse( +"Sun\xe3\x80\x80Aug 16 01:02:03 \xe6\x97\xa5\xe6\x9c\xac 2009". + force_encoding('utf-8')) + assert_equal(2009, h[:year]) + assert_equal(8, h[:mon]) + assert_equal(16, h[:mday]) + assert_equal(0, h[:wday]) + assert_equal(1, h[:hour]) + assert_equal(2, h[:min]) + assert_equal(3, h[:sec]) + assert_equal("\xe6\x97\xa5\xe6\x9c\xac". + force_encoding('utf-8'), h[:zone]) + end + def test_parse__ex assert_raise(ArgumentError) do Date.parse('') |