10 use lib "$FindBin::Bin";
16 given => \'colA DESC',
17 expects => ' ORDER BY colA DESC',
18 expects_quoted => ' ORDER BY colA DESC',
22 expects => ' ORDER BY colA',
23 expects_quoted => ' ORDER BY `colA`',
26 given => [qw/colA colB/],
27 expects => ' ORDER BY colA, colB',
28 expects_quoted => ' ORDER BY `colA`, `colB`',
31 given => {-asc => 'colA'},
32 expects => ' ORDER BY colA ASC',
33 expects_quoted => ' ORDER BY `colA` ASC',
36 given => {-desc => 'colB'},
37 expects => ' ORDER BY colB DESC',
38 expects_quoted => ' ORDER BY `colB` DESC',
41 given => [{-asc => 'colA'}, {-desc => 'colB'}],
42 expects => ' ORDER BY colA ASC, colB DESC',
43 expects_quoted => ' ORDER BY `colA` ASC, `colB` DESC',
46 given => ['colA', {-desc => 'colB'}],
47 expects => ' ORDER BY colA, colB DESC',
48 expects_quoted => ' ORDER BY `colA`, `colB` DESC',
52 my $sql = SQL::Abstract->new;
53 my $sqlq = SQL::Abstract->new({quote_char => '`'});
55 plan tests => (scalar(@cases) * 2);
57 for my $case( @cases){
58 is($sql->_order_by($case->{given}), $case->{expects});
59 is($sqlq->_order_by($case->{given}), $case->{expects_quoted});