Skip to content

Commit 7cc3cc6

Browse files
author
Jim Flood
committed
Add test to show problem with function returning BLOB
1 parent 8537243 commit 7cc3cc6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/test_database.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,19 @@ def test_function_return
261261
end
262262

263263
def test_function_return_types
264-
[10, 2.2, nil, "foo"].each do |thing|
264+
[10, 2.2, nil, "foo", Blob.new("foo\0bar")].each do |thing|
265265
@db.define_function("hello") { |a| thing }
266266
assert_equal [thing], @db.execute("select hello('world')").first
267267
end
268268
end
269269

270+
def test_function_return_type_round_trip
271+
[10, 2.2, nil, "foo", Blob.new("foo\0bar")].each do |thing|
272+
@db.define_function("hello") { |thing| thing }
273+
assert_equal [thing], @db.execute("select hello(hello(?))", [thing]).first
274+
end
275+
end
276+
270277
def test_define_function_closed
271278
@db.close
272279
assert_raise(SQLite3::Exception) do

0 commit comments

Comments
 (0)