SQL: Doc and test adjustments

This commit is contained in:
Yorhel 2025-02-21 10:22:33 +01:00
parent 145d086bea
commit 8036b8f0bf
2 changed files with 34 additions and 10 deletions

18
t/sql.t
View file

@ -68,4 +68,22 @@ t IN([]), '= ANY($1)', [[]], in_style => 'pg', placeholder_style => 'pg';
t WHERE({ id => IN([1,2]) }), 'WHERE ( id IN(?,?) )', [1,2];
sub somefunc { 'not actually const' }
t SQL(somefunc), '?', [somefunc];
use constant constval => 'this is a constant';
t SQL(constval), constval, [];
sub otherfunc { constval }
t SQL(otherfunc), '?', [otherfunc];
sub passthrough { $_[0] }
t SQL(passthrough 'hi'), '?', ['hi'];
use Hash::Util;
my %hash = (v => 'value');
Hash::Util::lock_keys(%hash);
Hash::Util::lock_value(%hash, 'v');
t SQL($hash{v}), 'value', [];
done_testing;