From: Arthur Axel "fREW" Schmidt Date: Thu, 16 Sep 2010 14:44:32 +0000 (+0000) Subject: add a bit more doc, test doc, and rename a method X-Git-Tag: v1.70~58 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FSQL-Abstract.git;a=commitdiff_plain;h=f2ab166a82ed8b2e1c75b960e7d0fb8209cb6f50 add a bit more doc, test doc, and rename a method --- diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index 7fbf47a..aa8bc2f 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -318,7 +318,7 @@ my %starters = ( 'delete from' => 1, ); -sub whitespace_keyword { +sub pad_keyword { my ($self, $keyword, $depth) = @_; my $before = ''; @@ -382,7 +382,7 @@ sub unparse { return join (" $car ", map $self->unparse($_, $bindargs, $depth), @{$cdr}); } else { - my ($l, $r) = @{$self->whitespace_keyword($car, $depth)}; + my ($l, $r) = @{$self->pad_keyword($car, $depth)}; return sprintf "$l%s %s$r", $self->format_keyword($car), $self->unparse($cdr, $bindargs, $depth); } } @@ -469,9 +469,9 @@ Transform "tree" into SQL, applying various transforms on the way. Currently this just takes a keyword and puts the C stuff around it. Later on it may do more and allow for coderef based transforms. -=head2 whitespace_keyword +=head2 pad_keyword - my ($before, $after) = @{$sqlat->whitespace_keyword('SELECT')}; + my ($before, $after) = @{$sqlat->pad_keyword('SELECT')}; Returns whitespace to be inserted around a keyword. @@ -481,3 +481,38 @@ Returns whitespace to be inserted around a keyword. Removes last arg from passed arrayref and returns it, surrounded with the values in placeholder_surround, and then surrounded with single quotes. + +=head2 indent + +Returns as many indent strings as indent amounts times the first argument. + +=head1 ACCESSORS + +=head2 colormap + +See L + +=head2 fill_in_placeholders + +See L + +=head2 indent_amount + +See L + +=head2 indent_string + +See L + +=head2 indentmap + +See L + +=head2 newline + +See L + +=head2 placeholder_surround + +See L + diff --git a/t/13whitespace_keyword.t b/t/13whitespace_keyword.t index 838ed04..20929bf 100644 --- a/t/13whitespace_keyword.t +++ b/t/13whitespace_keyword.t @@ -20,11 +20,11 @@ my $sqlat = SQL::Abstract::Tree->new({ }); for ( keys %{$sqlat->indentmap}) { - my ($l, $r) = @{$sqlat->whitespace_keyword($_, 1)}; + my ($l, $r) = @{$sqlat->pad_keyword($_, 1)}; is($r, ' ', "right is a space for $_"); is($l, "\n " . ' ' x $sqlat->indentmap->{$_}, "left calculated correctly for $_" ); } -is($sqlat->whitespace_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0'); +is($sqlat->pad_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0'); done_testing; diff --git a/t/91podcoverage.t b/t/91podcoverage.t index 94a2e36..7a80911 100644 --- a/t/91podcoverage.t +++ b/t/91podcoverage.t @@ -28,7 +28,6 @@ my $exceptions = { ] }, 'SQL::Abstract::Test' => { skip => 1 }, - 'SQL::Abstract::Tree' => { skip => 1 }, 'DBIx::Class::Storage::Debug::PrettyPrint' => { skip => 1 }, };