12 given => \'colA DESC',
13 expects => ' ORDER BY colA DESC',
14 expects_quoted => ' ORDER BY colA DESC',
18 expects => ' ORDER BY colA',
19 expects_quoted => ' ORDER BY `colA`',
22 given => [qw/colA colB/],
23 expects => ' ORDER BY colA, colB',
24 expects_quoted => ' ORDER BY `colA`, `colB`',
27 given => {-asc => 'colA'},
28 expects => ' ORDER BY colA ASC',
29 expects_quoted => ' ORDER BY `colA` ASC',
32 given => {-desc => 'colB'},
33 expects => ' ORDER BY colB DESC',
34 expects_quoted => ' ORDER BY `colB` DESC',
37 given => [{-asc => 'colA'}, {-desc => 'colB'}],
38 expects => ' ORDER BY colA ASC, colB DESC',
39 expects_quoted => ' ORDER BY `colA` ASC, `colB` DESC',
42 given => ['colA', {-desc => 'colB'}],
43 expects => ' ORDER BY colA, colB DESC',
44 expects_quoted => ' ORDER BY `colA`, `colB` DESC',
48 my $sql = SQL::Abstract->new;
49 my $sqlq = SQL::Abstract->new({quote_char => '`'});
51 plan tests => (scalar(@cases) * 2);
53 for my $case( @cases){
54 is($sql->_order_by($case->{given}), $case->{expects});
55 is($sqlq->_order_by($case->{given}), $case->{expects_quoted});