remove obsolete thing that never worked
[scpubgit/Q-Branch.git] / t / 15placeholders.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use SQL::Abstract::Tree;
6
7 {
8    my $sqlat = SQL::Abstract::Tree->new({
9       fill_in_placeholders => 1,
10       placeholder_surround => [qw(; -)],
11    });
12
13    is($sqlat->fill_in_placeholder(['lolz']), q(;lolz-),
14       'placeholders are populated correctly'
15    );
16 }
17
18 {
19    my $sqlat = SQL::Abstract::Tree->new({
20       fill_in_placeholders => 1,
21       placeholder_surround => [qw(< >)],
22    });
23
24    is($sqlat->fill_in_placeholder(['station']), q(<station>),
25       'placeholders are populated correctly and in order'
26    );
27 }
28
29
30 {
31    my $sqlat = SQL::Abstract::Tree->new({
32       fill_in_placeholders => 1,
33       placeholder_surround => [qw(' ')],
34    });
35
36    is $sqlat->format('SELECT ? AS x, ? AS y FROM Foo WHERE t > ? and z IN (?, ?, ?) ', [qw/frew ribasushi 2008-12-12 1 2 3/]),
37    q[SELECT 'frew' AS x, 'ribasushi' AS y FROM Foo WHERE t > '2008-12-12' AND z IN ( '1', '2', '3' )], 'Complex placeholders work';
38 }
39
40 done_testing;