From: Arthur Axel 'fREW' Schmidt Date: Sun, 24 Oct 2010 20:20:29 +0000 (-0500) Subject: test for no-repeats X-Git-Tag: v1.70~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=51bd937f8271bda52a78b4fadbcc058568b18956;p=dbsrgits%2FSQL-Abstract.git test for no-repeats --- diff --git a/t/dbic/no-repeats.t b/t/dbic/no-repeats.t new file mode 100644 index 0000000..fd53867 --- /dev/null +++ b/t/dbic/no-repeats.t @@ -0,0 +1,67 @@ +use strict; +use warnings; + +use Test::More; +use DBIx::Class::Storage::Debug::PrettyPrint; + +my $cap; +open my $fh, '>', \$cap; + +my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({ + profile => 'none', + no_repeats => 1, + fill_in_placeholders => 1, + placeholder_surround => [qw(' ')], + show_progress => 0, +}); + +$pp->debugfh($fh); + +$pp->query_start('SELECT * FROM frew WHERE id = ?', q('1')); +is( + $cap, + qq(SELECT * FROM frew WHERE id = '1'\n\n), + 'SQL Logged' +); + +open $fh, '>', \$cap; +$pp->query_start('SELECT * FROM frew WHERE id = ?', q('2')); +is( + $cap, + qq(... : '2'\n\n), + 'Repeated SQL ellided' +); + +open $fh, '>', \$cap; +$pp->query_start('SELECT * FROM frew WHERE id = ?', q('3')); +is( + $cap, + qq(... : '3'\n\n), + 'Repeated SQL ellided' +); + +open $fh, '>', \$cap; +$pp->query_start('SELECT * FROM frew WHERE id = ?', q('4')); +is( + $cap, + qq(... : '4'\n\n), + 'Repeated SQL ellided' +); + +open $fh, '>', \$cap; +$pp->query_start('SELECT * FROM bar WHERE id = ?', q('4')); +is( + $cap, + qq(SELECT * FROM bar WHERE id = '4'\n\n), + 'New SQL Logged' +); + +open $fh, '>', \$cap; +$pp->query_start('SELECT * FROM frew WHERE id = ?', q('1')); +is( + $cap, + qq(SELECT * FROM frew WHERE id = '1'\n\n), + 'New SQL Logged' +); + +done_testing;