X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F15placeholders.t;h=55731a84aaf4b5826b6bf0aaf42d05e14541bcd8;hb=fda0b270e45b2f419edf94e4f7e91d82d31c6f84;hp=4ee0db83a8d453c5597eca6be644d2658e938e3e;hpb=ad46269d24e7252a1b0bf635478c64ea522d57d1;p=scpubgit%2FQ-Branch.git diff --git a/t/15placeholders.t b/t/15placeholders.t index 4ee0db8..55731a8 100644 --- a/t/15placeholders.t +++ b/t/15placeholders.t @@ -4,15 +4,13 @@ use warnings; use Test::More; use SQL::Abstract::Tree; -my $placeholders = ['station', 'lolz']; - { my $sqlat = SQL::Abstract::Tree->new({ fill_in_placeholders => 1, placeholder_surround => [qw(; -)], }); - is($sqlat->fill_in_placeholder($placeholders), q(;lolz-), + is($sqlat->fill_in_placeholder(['lolz']), q(;lolz-), 'placeholders are populated correctly' ); } @@ -23,7 +21,7 @@ my $placeholders = ['station', 'lolz']; placeholder_surround => [qw(< >)], }); - is($sqlat->fill_in_placeholder($placeholders), q(), + is($sqlat->fill_in_placeholder(['station']), q(), 'placeholders are populated correctly and in order' ); } @@ -35,8 +33,8 @@ my $placeholders = ['station', 'lolz']; placeholder_surround => [qw(' ')], }); - is $sqlat->format('SELECT ? as x, ? as y FROM Foo WHERE t > ? and z IN (?, ?, ?) ', ['frew', 'ribasushi', '2008-12-12', 1, 2, 3]), - q[SELECT 'frew' as x, 'ribasushi' as y FROM Foo WHERE t > '2008-12-12' AND z IN ('1', '2', '3')], 'Complex placeholders work'; + is $sqlat->format('SELECT ? AS x, ? AS y FROM Foo WHERE t > ? and z IN (?, ?, ?) ', [qw/frew ribasushi 2008-12-12 1 2 3/]), + q[SELECT 'frew' AS x, 'ribasushi' AS y FROM Foo WHERE t > '2008-12-12' AND z IN ( '1', '2', '3' )], 'Complex placeholders work'; } done_testing;