Skip to content

Commit d8aed51

Browse files
committed
Add some regression tests for setting pragmas
This commit just adds some test cases around the pragma APIs
1 parent d7e98cd commit d8aed51

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/sqlite3/database.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def initialize file, options = {}, zvfs = nil
196196
#
197197
# Fetch the encoding set on this database
198198
def encoding
199-
prepare("PRAGMA encoding") { |stmt| Encoding.find(stmt.first.first) }
199+
Encoding.find super
200200
end
201201

202202
# Installs (or removes) a block that will be invoked for every access

test/test_pragmas.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ def teardown
2727
@db.close
2828
end
2929

30+
def test_temp_store_mode
31+
@db.temp_store = "memory"
32+
assert_equal 2, @db.temp_store
33+
@db.temp_store = 1
34+
assert_equal 1, @db.temp_store
35+
end
36+
37+
def test_encoding
38+
@db.encoding = "utf-16le"
39+
assert_equal Encoding.find("utf-16le"), @db.encoding
40+
end
41+
3042
def test_pragma_errors
3143
assert_raises(SQLite3::Exception) do
3244
@db.set_enum_pragma("foo", "bar", [])

0 commit comments

Comments
 (0)