[前][次][番号順一覧][スレッド一覧]

ruby-changes:20915

From: tadf <ko1@a...>
Date: Sat, 13 Aug 2011 09:46:02 +0900 (JST)
Subject: [ruby-changes:20915] tadf:r32963 (trunk): * test/date/test_*.rb: added tests.

tadf	2011-08-13 09:41:10 +0900 (Sat, 13 Aug 2011)

  New Revision: 32963

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32963

  Log:
    * test/date/test_*.rb: added tests.

  Modified files:
    trunk/ChangeLog
    trunk/test/date/test_date_parse.rb
    trunk/test/date/test_date_strptime.rb
    trunk/test/date/test_switch_hitter.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32962)
+++ ChangeLog	(revision 32963)
@@ -1,3 +1,7 @@
+Sat Aug 13 09:39:07 2011  Tadayoshi Funaba  <tadf@d...>
+
+	* test/date/test_*.rb: added tests.
+
 Sat Aug 13 09:36:19 2011  CHIKANAGA Tomoyuki  <nagachika00@g...>
 
 	* ext/date/date_parse.c parse_ddd_cb): fix r32896. RB_GC_GUARD
Index: test/date/test_switch_hitter.rb
===================================================================
--- test/date/test_switch_hitter.rb	(revision 32962)
+++ test/date/test_switch_hitter.rb	(revision 32963)
@@ -218,6 +218,15 @@
     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))
Index: test/date/test_date_strptime.rb
===================================================================
--- test/date/test_date_strptime.rb	(revision 32962)
+++ test/date/test_date_strptime.rb	(revision 32963)
@@ -456,6 +456,12 @@
 
   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
     assert_raise(ArgumentError) do
@@ -464,6 +470,9 @@
     assert_raise(ArgumentError) do
       Date.strptime('23:55', '%H:%M')
     end
+    assert_raise(ArgumentError) do
+      Date.strptime('??-??-????', '%m/%d/%Y')
+    end
   end
 
 end
Index: test/date/test_date_parse.rb
===================================================================
--- test/date/test_date_parse.rb	(revision 32962)
+++ test/date/test_date_parse.rb	(revision 32963)
@@ -656,6 +656,9 @@
       Date.parse('')
     end
     assert_raise(ArgumentError) do
+      DateTime.parse('')
+    end
+    assert_raise(ArgumentError) do
       Date.parse('2001-02-29')
     end
     assert_raise(ArgumentError) do

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]