about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-02-14 05:37:25 +0000
committerEric Wong <e@80x24.org>2022-02-14 18:43:16 +0000
commit2231c8b183be0be5d8a9738a3e417b5c3a09c7c7 (patch)
tree4589decb5859338bd731e7f647d69252db46a06f /t
parent80690e594710f2fb89d306f1f5faf4a57aea79c8 (diff)
downloadpublic-inbox-2231c8b183be0be5d8a9738a3e417b5c3a09c7c7.tar.gz
While we only store URLs and binary SHA-1/SHA-256 values in skv
at the moment, we may store potentially ambiguous keys/values in
the future.  It's possible to store "02" and have it treated as
`2' unless explicitly binding parameters as SQL_BLOB.  This
behavior was independent of the sqlite_unicode parameter as
evidenced by the new tests.

I only noticed this bug while hacking on another project using
DBD::SQLite, and not while hacking on public-inbox itself.
Diffstat (limited to 't')
-rw-r--r--t/shared_kv.t3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/shared_kv.t b/t/shared_kv.t
index 8b4f9c29..8dfd3b25 100644
--- a/t/shared_kv.t
+++ b/t/shared_kv.t
@@ -42,5 +42,8 @@ undef $skv;
 ok(!-d $skv_tmpdir, 'temporary dir gone');
 $skv = PublicInbox::SharedKV->new("$tmpdir/dir", 'base');
 ok(-e "$tmpdir/dir/base.sqlite3", 'file created');
+$skv->dbh;
+ok($skv->set_maybe('02', '2'), "`02' set");
+ok($skv->set_maybe('2', '2'), "`2' set (no match on `02')");
 
 done_testing;