Commit | Line | Data |
7a56723e |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More tests => 4; |
5 | use Test::Differences; |
6 | |
7 | use_ok('SQL::Abstract') or BAIL_OUT( "$@" ); |
8 | |
9 | my $sqla = SQL::Abstract->create(1); |
10 | |
11 | |
12 | is $sqla->dispatch( |
13 | { -type => 'order_by', order_by => [ { -type => name => args => [qw/me date/ ] } ] } |
14 | ), "ORDER BY me.date", |
15 | "order by"; |
16 | |
17 | is $sqla->dispatch( |
18 | { -type => 'order_by', |
19 | order_by => [ |
20 | { -type => name => args => [qw/me date/] }, |
21 | { -type => name => args => [qw/me foobar/] }, |
22 | ] |
23 | } |
24 | ), "ORDER BY me.date, me.foobar", |
25 | "order by"; |
26 | |
27 | # Hrmmm how to mark this up. |
28 | is $sqla->dispatch( |
29 | { -type => 'order_by', |
30 | order_by => [ |
31 | [ -desc => { -type => name => args => [qw/me date/ ] } ] |
32 | ] |
33 | } |
34 | ), "ORDER BY me.date DESC", |
35 | "order by desc"; |