4 use Test::More tests => 10;
7 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
8 use_ok('SQL::Abstract::AST::v1') or BAIL_OUT( "$@" );
10 my $sqla = SQL::Abstract->create(1);
12 # TODO: once MXMS supports %args, use that here
13 is $sqla->dispatch( { -type => 'identifier', elements => [qw/me id/] }), "me.id",
14 "Simple identifier generator";
16 is $sqla->dispatch( { -type => 'identifier', elements => ['*'] } ),
18 "* identifier generator";
20 is $sqla->dispatch( { -type => 'identifier', elements => [qw/me */]}),
22 "Simple identifier generator";
24 $sqla->quote_chars(['`']);
26 is $sqla->dispatch( { -type => 'identifier', elements => [qw/me */]}),
28 "Simple identifier generator";
30 $sqla->disable_quoting;
34 ), "0 = 1", "false value";
38 ), "1 = 1", "true value";
43 { -type => identifier => elements => [qw/me id/] },
44 { -type => identifier => elements => [qw/me foo bar/] },
45 { -type => identifier => elements => [qw/bar/] }
48 ), "me.id, me.foo.bar, bar",
52 { -type => 'alias', ident => { -type => identifier => elements => [qw/me id/]}, as => "foobar" }