Class: SQLite3::TestDeprecated

Inherits:
TestCase
  • Object
show all
Defined in:
lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb,
lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TestCase

#assert_nothing_raised

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



5
6
7
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 5

def db
  @db
end

Instance Method Details

#setupObject



7
8
9
10
11
12
13
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 7

def setup
  super
  @warn_before = $-w
  $-w = false
  @db = SQLite3::Database.new(':memory:')
  @db.execute 'CREATE TABLE test_table (name text, age int)'
end

#teardownObject



15
16
17
18
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 15

def teardown
  super
  $-w = @warn_before
end

#test_execute_with_many_bind_paramsObject



36
37
38
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 36

def test_execute_with_many_bind_params
  assert_equal [[nil, 1]], @db.execute("select ?, ?", nil, 1)
end

#test_execute_with_many_bind_params_not_nilObject



24
25
26
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 24

def test_execute_with_many_bind_params_not_nil
  assert_equal [[1, 2]], @db.execute("select ?, ?", 1, 2).to_a
end

#test_execute_with_nil_bind_paramsObject



40
41
42
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 40

def test_execute_with_nil_bind_params
  assert_equal [['foo']], @db.execute("select 'foo'", nil)
end

#test_query_with_many_bind_paramsObject



28
29
30
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 28

def test_query_with_many_bind_params
  assert_equal [[nil, 1]], @db.query("select ?, ?", nil, 1).to_a
end

#test_query_with_many_bind_params_not_nilObject



20
21
22
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 20

def test_query_with_many_bind_params_not_nil
  assert_equal [[1, 2]], db.query('select ?, ?', 1, 2).to_a
end

#test_query_with_nil_bind_paramsObject



32
33
34
# File 'lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb', line 32

def test_query_with_nil_bind_params
  assert_equal [['foo']], @db.query("select 'foo'", nil).to_a
end