2010-06-11 05:42:33 +02:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
module SQLite3
|
|
|
|
class TestDeprecated < Test::Unit::TestCase
|
|
|
|
def setup
|
2010-07-21 03:36:17 +02:00
|
|
|
super
|
|
|
|
@warn_before = $-w
|
|
|
|
$-w = false
|
2010-06-11 05:42:33 +02:00
|
|
|
@db = SQLite3::Database.new(':memory:')
|
|
|
|
end
|
|
|
|
|
2010-07-21 03:36:17 +02:00
|
|
|
def teardown
|
|
|
|
super
|
|
|
|
$-w = @warn_before
|
|
|
|
end
|
|
|
|
|
2010-06-11 05:42:33 +02:00
|
|
|
def test_query_with_many_bind_params
|
|
|
|
assert_equal [[nil, 1]], @db.query("select ?, ?", nil, 1).to_a
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_query_with_nil_bind_params
|
|
|
|
assert_equal [['foo']], @db.query("select 'foo'", nil).to_a
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute_with_many_bind_params
|
|
|
|
assert_equal [[nil, 1]], @db.execute("select ?, ?", nil, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute_with_nil_bind_params
|
|
|
|
assert_equal [['foo']], @db.execute("select 'foo'", nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|