[ruby-oci8-commit] [481] trunk/ruby-oci8: fix test_select when TZ set to daylight saving time.

nobody at rubyforge.org nobody at rubyforge.org
Sat Dec 10 00:50:41 EST 2011


Revision: 481
Author:   kubo
Date:     2011-12-10 00:50:41 -0500 (Sat, 10 Dec 2011)

Log Message:
-----------
fix test_select when TZ set to daylight saving time.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/test/test_oci8.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-12-06 12:56:44 UTC (rev 480)
+++ trunk/ruby-oci8/ChangeLog	2011-12-10 05:50:41 UTC (rev 481)
@@ -1,3 +1,7 @@
+2011-12-10  KUBO Takehiro  <kubo at jiubao.org>
+	* test/test_oci8.rb: fix test_select when TZ set to daylight saving time.
+	    (reported by Yasuo Honda)
+
 2011-12-06  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/oci8.c: raise a RuntimeError when non-blocking mode is set to a connection
 	    allocated from OCI8::ConnectionPool on ruby 1.8.

Modified: trunk/ruby-oci8/test/test_oci8.rb
===================================================================
--- trunk/ruby-oci8/test/test_oci8.rb	2011-12-06 12:56:44 UTC (rev 480)
+++ trunk/ruby-oci8/test/test_oci8.rb	2011-12-10 05:50:41 UTC (rev 481)
@@ -96,9 +96,9 @@
     cursor = @conn.parse("INSERT INTO test_table VALUES (:C, :V, :N, :D1, :D2, :D3, :D4, :INT, :BIGNUM)")
     1.upto(10) do |i|
       if i == 1
-	dt = [nil, OraDate]
+        dt = [nil, OraDate]
       else
-	dt = OraDate.new(2000 + i, 8, 3, 23, 59, 59)
+        dt = OraDate.new(2000 + i, i % 2 == 0 ? 7 : 1, 3, 23, 59, 59)
       end
       cursor.exec(format("%10d", i * 10), i.to_s, i, dt, dt, dt, dt, i * 11111111111, i * 10000000000)
     end
@@ -122,9 +122,10 @@
 	assert_nil(rv[5])
 	assert_nil(rv[6])
       else
-        tm = Time.local(2000 + i, 8, 3, 23, 59, 59)
-	dt = Date.civil(2000 + i, 8, 3)
-	dttm = DateTime.civil(2000 + i, 8, 3, 23, 59, 59, Time.now.utc_offset.to_r/86400)
+        month = i % 2 == 0 ? 7 : 1
+        tm = Time.local(2000 + i, month, 3, 23, 59, 59)
+        dt = Date.civil(2000 + i, month, 3)
+        dttm = DateTime.civil(2000 + i, month, 3, 23, 59, 59, tm.utc_offset.to_r/86400)
 	assert_equal(tm, rv[3])
 	assert_equal(tm, rv[4])
 	assert_equal(dt, rv[5])
@@ -148,9 +149,10 @@
 	assert_nil(row['D3'])
 	assert_nil(row['D4'])
       else
-        tm = Time.local(2000 + i, 8, 3, 23, 59, 59)
-	dt = Date.civil(2000 + i, 8, 3)
-	dttm = DateTime.civil(2000 + i, 8, 3, 23, 59, 59, Time.now.utc_offset.to_r/86400)
+        month = i % 2 == 0 ? 7 : 1
+        tm = Time.local(2000 + i, month, 3, 23, 59, 59)
+        dt = Date.civil(2000 + i, month, 3)
+        dttm = DateTime.civil(2000 + i, month, 3, 23, 59, 59, tm.utc_offset.to_r/86400)
 	assert_equal(tm, row['D1'])
 	assert_equal(tm, row['D2'])
 	assert_equal(dt, row['D3'])




More information about the ruby-oci8-commit mailing list