Skip to content

Commit 82085b6

Browse files
committed
ruby: drop support for Ruby 2.7
and delete code and tests that branched on RUBY_VERSION
1 parent 40e7b29 commit 82085b6

File tree

6 files changed

+25
-69
lines changed

6 files changed

+25
-69
lines changed

ext/sqlite3/extconf.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ def configure_packaged_libraries
9797
end
9898

9999
def configure_extension
100-
if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION))
101-
append_cppflags("-DTAINTING_SUPPORT")
102-
end
103-
104100
append_cflags("-fvisibility=hidden") # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
105101

106102
if find_header("sqlite3.h")

sqlite3.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
2020

2121
s.licenses = ["BSD-3-Clause"]
2222

23-
s.required_ruby_version = Gem::Requirement.new(">= 2.7")
23+
s.required_ruby_version = Gem::Requirement.new(">= 3.0")
2424

2525
s.homepage = "https://github.com/sparklemotion/sqlite3-ruby"
2626
s.metadata = {

test/test_collation.rb

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,34 @@ def test_remove_collation
4747
end
4848
end
4949

50-
if RUBY_VERSION >= '1.9.1'
51-
def test_encoding
52-
comparator = Comparator.new
53-
@db.collation 'foo', comparator
54-
@db.execute('select data from ex order by 1 collate foo')
50+
def test_encoding
51+
comparator = Comparator.new
52+
@db.collation 'foo', comparator
53+
@db.execute('select data from ex order by 1 collate foo')
5554

56-
a, b = *comparator.calls.first
55+
a, b = *comparator.calls.first
5756

58-
assert_equal Encoding.find('UTF-8'), a.encoding
59-
assert_equal Encoding.find('UTF-8'), b.encoding
60-
end
57+
assert_equal Encoding.find('UTF-8'), a.encoding
58+
assert_equal Encoding.find('UTF-8'), b.encoding
59+
end
6160

62-
def test_encoding_default_internal
63-
warn_before = $-w
64-
$-w = false
65-
before_enc = Encoding.default_internal
61+
def test_encoding_default_internal
62+
warn_before = $-w
63+
$-w = false
64+
before_enc = Encoding.default_internal
6665

67-
Encoding.default_internal = 'EUC-JP'
68-
comparator = Comparator.new
69-
@db.collation 'foo', comparator
70-
@db.execute('select data from ex order by 1 collate foo')
66+
Encoding.default_internal = 'EUC-JP'
67+
comparator = Comparator.new
68+
@db.collation 'foo', comparator
69+
@db.execute('select data from ex order by 1 collate foo')
7170

72-
a, b = *comparator.calls.first
71+
a, b = *comparator.calls.first
7372

74-
assert_equal Encoding.find('EUC-JP'), a.encoding
75-
assert_equal Encoding.find('EUC-JP'), b.encoding
76-
ensure
77-
Encoding.default_internal = before_enc
78-
$-w = warn_before
79-
end
73+
assert_equal Encoding.find('EUC-JP'), a.encoding
74+
assert_equal Encoding.find('EUC-JP'), b.encoding
75+
ensure
76+
Encoding.default_internal = before_enc
77+
$-w = warn_before
8078
end
8179
end
8280
end

test/test_database.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,7 @@ def test_new_with_options
237237
# determine if Ruby is running on Big Endian platform
238238
utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE"
239239

240-
if RUBY_VERSION >= "1.9"
241-
db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true)
242-
else
243-
db = SQLite3::Database.new(Iconv.conv(utf16, 'UTF-8', ':memory:'),
244-
:utf16 => true)
245-
end
240+
db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true)
246241
assert_instance_of(SQLite3::Database, db)
247242
ensure
248243
db.close if db

test/test_encoding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,5 @@ def test_euc_jp
161161
assert_equal str.encode('UTF-8'), row.first.first
162162
end
163163

164-
end if RUBY_VERSION >= '1.9.1'
164+
end
165165
end

test/test_integration_pending.rb

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,6 @@ def teardown
1919
File.delete( "test.db" )
2020
end
2121

22-
def test_busy_handler_outwait
23-
skip("not working in 1.9") if RUBY_VERSION >= '1.9'
24-
25-
busy = Mutex.new
26-
busy.lock
27-
handler_call_count = 0
28-
29-
t = Thread.new(busy) do |locker|
30-
begin
31-
db2 = SQLite3::Database.open( "test.db" )
32-
db2.transaction( :exclusive ) do
33-
locker.lock
34-
end
35-
ensure
36-
db2.close if db2
37-
end
38-
end
39-
40-
@db.busy_handler do |data,count|
41-
handler_call_count += 1
42-
busy.unlock
43-
true
44-
end
45-
46-
assert_nothing_raised do
47-
@db.execute "insert into foo (b) values ( 'from 2' )"
48-
end
49-
50-
t.join
51-
52-
assert_equal 1, handler_call_count
53-
end
54-
5522
def test_busy_handler_impatient
5623
busy = Mutex.new
5724
busy.lock

0 commit comments

Comments
 (0)