File: tc_statementhandle.rb

package info (click to toggle)
libdbi-ruby 0.4.3-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 472 kB
  • ctags: 619
  • sloc: ruby: 4,583; makefile: 62; perl: 12
file content (29 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$: << 'lib'
require 'test/unit'
require 'dbi'

class TC_DBI_StatementHandle < Test::Unit::TestCase
    def test_fetch
        mock_handle = 'any_object'
        def mock_handle.cancel; end
        def mock_handle.column_info; {}; end
        def mock_handle.fetch; nil; end
        sth = DBI::StatementHandle.new( mock_handle, true, true, false, true)
        
        10.times do
            assert_nil sth.fetch
        end

        sth.raise_error = true

        assert_raises(DBI::InterfaceError) do
            sth.fetch
        end

        sth.raise_error = false

        10.times do
            assert_nil sth.fetch
        end
    end
end