@@ -26,7 +26,7 @@ def test_db_filename
2626 @db = SQLite3 ::Database . new tf . path
2727 assert_equal File . realdirpath ( tf . path ) , File . realdirpath ( @db . filename ( "main" ) )
2828 ensure
29- tf . unlink if tf
29+ tf & .unlink
3030 end
3131
3232 def test_filename
@@ -36,7 +36,7 @@ def test_filename
3636 @db = SQLite3 ::Database . new tf . path
3737 assert_equal File . realdirpath ( tf . path ) , File . realdirpath ( @db . filename )
3838 ensure
39- tf . unlink if tf
39+ tf & .unlink
4040 end
4141
4242 def test_filename_with_attachment
@@ -47,7 +47,7 @@ def test_filename_with_attachment
4747
4848 assert_equal File . realdirpath ( tf . path ) , File . realdirpath ( @db . filename ( "testing" ) )
4949 ensure
50- tf . unlink if tf
50+ tf & .unlink
5151 end
5252
5353 def test_filename_to_path
@@ -56,8 +56,8 @@ def test_filename_to_path
5656 db = SQLite3 ::Database . new pn
5757 assert_equal pn . realdirpath . to_s , File . realdirpath ( db . filename )
5858 ensure
59- tf . close! if tf
60- db . close if db
59+ tf & .close!
60+ db & .close
6161 end
6262
6363 def test_error_code
@@ -200,14 +200,14 @@ def test_new
200200 db = SQLite3 ::Database . new ( ":memory:" )
201201 assert_instance_of ( SQLite3 ::Database , db )
202202 ensure
203- db . close if db
203+ db & .close
204204 end
205205
206206 def test_open
207207 db = SQLite3 ::Database . open ( ":memory:" )
208208 assert_instance_of ( SQLite3 ::Database , db )
209209 ensure
210- db . close if db
210+ db & .close
211211 end
212212
213213 def test_open_returns_block_result
@@ -240,7 +240,7 @@ def test_new_with_options
240240 db = SQLite3 ::Database . new ( ":memory:" . encode ( utf16 ) , utf16 : true )
241241 assert_instance_of ( SQLite3 ::Database , db )
242242 ensure
243- db . close if db
243+ db & .close
244244 end
245245
246246 def test_close
@@ -296,7 +296,7 @@ def test_prepare
296296 stmt = db . prepare ( 'select "hello world"' )
297297 assert_instance_of ( SQLite3 ::Statement , stmt )
298298 ensure
299- stmt . close if stmt
299+ stmt & .close
300300 end
301301
302302 def test_block_prepare_does_not_double_close
@@ -543,7 +543,7 @@ def call action, a, b, c, d
543543 stmt = @db . prepare ( "select 'fooooo'" )
544544 assert_nil stmt . step
545545 ensure
546- stmt . close if stmt
546+ stmt & .close
547547 end
548548
549549 def test_authorizer_fail
@@ -570,7 +570,7 @@ def call action, a, b, c, d
570570 @db . authorizer = nil
571571 s = @db . prepare ( "select 'fooooo'" )
572572 ensure
573- s . close if s
573+ s & .close
574574 end
575575
576576 def test_close_with_open_statements
@@ -579,7 +579,7 @@ def test_close_with_open_statements
579579 @db . close
580580 end
581581 ensure
582- s . close if s
582+ s & .close
583583 end
584584
585585 def test_execute_with_empty_bind_params
@@ -590,7 +590,7 @@ def test_query_with_named_bind_params
590590 resultset = @db . query ( "select :n" , { "n" => "foo" } )
591591 assert_equal [ [ "foo" ] ] , resultset . to_a
592592 ensure
593- resultset . close if resultset
593+ resultset & .close
594594 end
595595
596596 def test_execute_with_named_bind_params
@@ -669,7 +669,7 @@ def test_default_transaction_mode
669669 db2 . close if db2 && !db2 . closed?
670670 end
671671 ensure
672- tf . unlink if tf
672+ tf & .unlink
673673 end
674674 end
675675end
0 commit comments