mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/date/test_*.rb: added tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14b57772ec
commit
c67712ef63
4 changed files with 25 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat Aug 13 09:39:07 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* test/date/test_*.rb: added tests.
|
||||
|
||||
Sat Aug 13 09:36:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||
|
||||
* ext/date/date_parse.c parse_ddd_cb): fix r32896. RB_GC_GUARD
|
||||
|
|
|
@ -655,6 +655,9 @@ class TestDateParse < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) do
|
||||
Date.parse('')
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
DateTime.parse('')
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
Date.parse('2001-02-29')
|
||||
end
|
||||
|
|
|
@ -455,6 +455,12 @@ class TestDateStrptime < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_strptime__ex
|
||||
assert_raise(ArgumentError) do
|
||||
Date.strptime('')
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
DateTime.strptime('')
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
Date.strptime('2001-02-29', '%F')
|
||||
end
|
||||
|
@ -464,6 +470,9 @@ class TestDateStrptime < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) do
|
||||
Date.strptime('23:55', '%H:%M')
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
Date.strptime('01-31-2011', '%m/%d/%Y')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -218,6 +218,15 @@ class TestSH < Test::Unit::TestCase
|
|||
assert_equal(Encoding::US_ASCII, d.inspect.encoding)
|
||||
end
|
||||
|
||||
def test_strftime
|
||||
assert_raise(Errno::ERANGE) do
|
||||
Date.today.strftime('%100000z')
|
||||
end
|
||||
assert_raise(Errno::ERANGE) do
|
||||
Date.new(1 << 10000).strftime('%Y')
|
||||
end
|
||||
end
|
||||
|
||||
def test_cmp
|
||||
assert_equal(-1, Date.new(2001,2,3) <=> Date.new(2001,2,4))
|
||||
assert_equal(0, Date.new(2001,2,3) <=> Date.new(2001,2,3))
|
||||
|
|
Loading…
Reference in a new issue