cf5456a20ec57b1eb9d9ef44d3e04c66ab88075a
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 300_ordering.t
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 => 'ordering', expr => { -type => name => args => [qw/me date/ ] } }
14 ), "me.date",
15    "basic ordering";
16
17 is $sqla->dispatch(
18   { -type => 'ordering', 
19     expr => { -type => name => args => [qw/me date/] },
20     direction => 'DESC'
21   }
22 ), "me.date DESC",
23    "desc ordering";
24
25
26 is $sqla->dispatch(
27   { -type => 'ordering', 
28     expr => { -type => name => args => [qw/me date/] },
29     direction => 'asc'
30   }
31 ), "me.date ASC",
32    "asc ordering";