test/ResultSetTest.rb in rubyfb-0.5.7 vs test/ResultSetTest.rb in rubyfb-0.5.8
- old
+ new
@@ -6,12 +6,11 @@
require 'rubyfb'
include Rubyfb
class ResultSetTest < Test::Unit::TestCase
- CURDIR = "#{Dir.getwd}"
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}result_set_unit_test.fdb"
+ DB_FILE = File.join(DB_DIR, "result_set_unit_test.fdb")
def setup
puts "#{self.class.name} started." if TEST_LOGGING
if File::exist?(DB_FILE)
Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
@@ -169,7 +168,20 @@
assert_equal(-5, results.column_scale(0))
assert_equal(-1, results.column_scale(1))
assert_equal(0, results.column_scale(2))
ensure
results.close if results
+ end
+
+ def test06
+ results = @transactions.first.execute(<<-EOSQL)
+ SELECT * FROM RDB$DATABASE WHERE 1=0
+ EOSQL
+
+ assert_nil(results.fetch,
+ 'Initial #fetch of empty result set was not nil')
+ assert(results.exhausted?,
+ 'Completely fetched ResultSet was not #exhausted?')
+ assert_nil(results.fetch,
+ '#fetch after exhaustion was not nil')
end
end