fixup tests
[scpubgit/Q-Branch.git] / t / dbic / show-progress.t
diff --git a/t/dbic/show-progress.t b/t/dbic/show-progress.t
new file mode 100644 (file)
index 0000000..672d635
--- /dev/null
@@ -0,0 +1,31 @@
+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({
+   show_progress => 1,
+   clear_line    => 'CLEAR',
+   executing     => 'GOGOGO',
+});
+
+$pp->debugfh($fh);
+
+$pp->query_start('SELECT * FROM frew WHERE id = 1');
+is(
+   $cap,
+   qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGO),
+   'SQL Logged'
+);
+$pp->query_end('SELECT * FROM frew WHERE id = 1');
+is(
+   $cap,
+   qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGOCLEAR),
+   'SQL Logged'
+);
+
+done_testing;