Commit | Line | Data |
b4e0e260 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use SQL::Abstract::Tree; |
6 | |
7 | my $sqlat = SQL::Abstract::Tree->new({ |
ee4227a7 |
8 | newline => "\n", |
9 | indent_string => " ", |
10 | indent_amount => 1, |
11 | indentmap => { |
b4e0e260 |
12 | select => 0, |
13 | where => 1, |
14 | from => 2, |
15 | join => 3, |
16 | on => 4, |
17 | 'group by' => 5, |
18 | 'order by' => 6, |
ee4227a7 |
19 | }, |
b4e0e260 |
20 | }); |
21 | |
22 | for ( keys %{$sqlat->indentmap}) { |
f2ab166a |
23 | my ($l, $r) = @{$sqlat->pad_keyword($_, 1)}; |
e4570c8e |
24 | is($r, '', "right is empty for $_"); |
ee4227a7 |
25 | is($l, "\n " . ' ' x $sqlat->indentmap->{$_}, "left calculated correctly for $_" ); |
b4e0e260 |
26 | } |
27 | |
f2ab166a |
28 | is($sqlat->pad_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0'); |
b4e0e260 |
29 | |
30 | done_testing; |