Skip to content

Commit 701b6b8

Browse files
committed
Fix test skipping
1 parent 0ccc5e7 commit 701b6b8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

test/test_statement.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ def test_vm_steps
339339
end
340340

341341
def test_reprepares
342-
stmt = @db.prepare("SELECT * FROM test_table WHERE name LIKE ?")
343-
344-
skip("reprepares not defined") unless stmt.respond_to?(:reprepares)
345-
346342
@db.execute 'CREATE TABLE test_table (id INTEGER PRIMARY KEY, name TEXT);'
347343
10.times do |i|
348344
@db.execute 'INSERT INTO test_table (name) VALUES (?)', "name_#{i}"
349345
end
346+
stmt = @db.prepare("SELECT * FROM test_table WHERE name LIKE ?")
347+
348+
skip("reprepares not defined") unless stmt.respond_to?(:reprepares)
349+
350350
stmt.execute('name%').to_a
351351

352352
assert_equal 1, stmt.reprepares
@@ -355,12 +355,12 @@ def test_reprepares
355355
end
356356

357357
def test_runs
358+
@db.execute 'CREATE TABLE test1(a)'
359+
@db.execute 'INSERT INTO test1 VALUES (1)'
358360
stmt = @db.prepare('select * from test1')
359361

360362
skip("runs not defined") unless stmt.respond_to?(:runs)
361363

362-
@db.execute 'CREATE TABLE test1(a)'
363-
@db.execute 'INSERT INTO test1 VALUES (1)'
364364
stmt.execute.to_a
365365

366366
assert_equal 1, stmt.runs
@@ -369,16 +369,16 @@ def test_runs
369369
end
370370

371371
def test_filter_misses
372-
stmt = @db.prepare("SELECT * FROM t1, t2 WHERE a=c;")
373-
374-
skip("filter_misses not defined") unless stmt.respond_to?(:filter_misses)
375-
376372
@db.execute "CREATE TABLE t1(a,b);"
377373
@db.execute "CREATE TABLE t2(c,d);"
378374
10.times do |i|
379375
@db.execute 'INSERT INTO t1 (a, b) VALUES (?, ?)', [i, i.to_s]
380376
@db.execute 'INSERT INTO t2 (c, d) VALUES (?, ?)', [i, i.to_s]
381377
end
378+
stmt = @db.prepare("SELECT * FROM t1, t2 WHERE a=c;")
379+
380+
skip("filter_misses not defined") unless stmt.respond_to?(:filter_misses)
381+
382382
stmt.execute.to_a
383383

384384
assert_equal 10, stmt.filter_misses
@@ -387,16 +387,16 @@ def test_filter_misses
387387
end
388388

389389
def test_filter_hits
390-
stmt = @db.prepare("SELECT * FROM t1, t2 WHERE a=c AND b = '1' AND d = '1';")
391-
392-
skip("filter_hits not defined") unless stmt.respond_to?(:filter_hits)
393-
394390
@db.execute "CREATE TABLE t1(a,b);"
395391
@db.execute "CREATE TABLE t2(c,d);"
396392
10.times do |i|
397393
@db.execute 'INSERT INTO t1 (a, b) VALUES (?, ?)', [i, i.to_s]
398394
@db.execute 'INSERT INTO t2 (c, d) VALUES (?, ?)', [i+1, i.to_s]
399395
end
396+
stmt = @db.prepare("SELECT * FROM t1, t2 WHERE a=c AND b = '1' AND d = '1';")
397+
398+
skip("filter_hits not defined") unless stmt.respond_to?(:filter_hits)
399+
400400
stmt.execute.to_a
401401

402402
assert_equal 1, stmt.filter_hits
@@ -405,12 +405,12 @@ def test_filter_hits
405405
end
406406

407407
def test_memused
408+
@db.execute 'CREATE TABLE test1(a)'
409+
@db.execute 'INSERT INTO test1 VALUES (1)'
408410
stmt = @db.prepare('select * from test1')
409411

410412
skip("memused not defined") unless stmt.respond_to?(:memused)
411413

412-
@db.execute 'CREATE TABLE test1(a)'
413-
@db.execute 'INSERT INTO test1 VALUES (1)'
414414
stmt.execute.to_a
415415

416416
assert_operator stmt.memused, :>, 0

0 commit comments

Comments
 (0)