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

ruby-changes:20914

From: tadf <ko1@a...>
Date: Sat, 13 Aug 2011 09:45:58 +0900 (JST)
Subject: [ruby-changes:20914] tadf:r32964 (ruby_1_9_3): * test/date/test_*.rb: added tests.

tadf	2011-08-13 09:42:27 +0900 (Sat, 13 Aug 2011)

  New Revision: 32964

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

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

  Modified files:
    branches/ruby_1_9_3/test/date/test_date_parse.rb
    branches/ruby_1_9_3/test/date/test_date_strptime.rb
    branches/ruby_1_9_3/test/date/test_switch_hitter.rb

Index: ruby_1_9_3/test/date/test_switch_hitter.rb
===================================================================
--- ruby_1_9_3/test/date/test_switch_hitter.rb	(revision 32963)
+++ ruby_1_9_3/test/date/test_switch_hitter.rb	(revision 32964)
@@ -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: ruby_1_9_3/test/date/test_date_strptime.rb
===================================================================
--- ruby_1_9_3/test/date/test_date_strptime.rb	(revision 32963)
+++ ruby_1_9_3/test/date/test_date_strptime.rb	(revision 32964)
@@ -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: ruby_1_9_3/test/date/test_date_parse.rb
===================================================================
--- ruby_1_9_3/test/date/test_date_parse.rb	(revision 32963)
+++ ruby_1_9_3/test/date/test_date_parse.rb	(revision 32964)
@@ -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/

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