File: 13whitespace_keyword.t

package info (click to toggle)
libsql-abstract-perl 2.000001-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 744 kB
  • sloc: perl: 3,443; makefile: 8
file content (30 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;

use Test::More;
use SQL::Abstract::Tree;

my $sqlat = SQL::Abstract::Tree->new({
   newline => "\n",
   indent_string => " ",
   indent_amount => 1,
   indentmap => {
      select     => 0,
      where      => 1,
      from       => 2,
      join       => 3,
      on         => 4,
      'group by' => 5,
      'order by' => 6,
   },
});

for ( keys %{$sqlat->indentmap}) {
   my ($l, $r) = @{$sqlat->pad_keyword($_, 1)};
   is($r, '', "right is empty for $_");
   is($l, "\n " . ' ' x $sqlat->indentmap->{$_}, "left calculated correctly for $_" );
}

is($sqlat->pad_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0');

done_testing;