Fix syntax error in example
[dbsrgits/SQL-Abstract.git] / t / dbic / show-progress.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 BEGIN {
7   # ask for a recent DBIC version to skip the 5.6 tests as well
8   plan skip_all => 'Test temporarily requires DBIx::Class'
9     unless eval { require DBIx::Class::Storage::Statistics; DBIx::Class->VERSION('0.08124') };
10
11   plan skip_all => 'Test does not properly work with the pre-0.082800 DBIC trials'
12     if DBIx::Class->VERSION =~ /^0.082700\d\d/;
13 }
14
15 use DBIx::Class::Storage::Debug::PrettyPrint;
16
17 my $cap;
18 open my $fh, '>', \$cap;
19
20 my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({
21    show_progress => 1,
22    clear_line    => 'CLEAR',
23    executing     => 'GOGOGO',
24 });
25
26 $pp->debugfh($fh);
27
28 $pp->query_start('SELECT * FROM frew WHERE id = 1');
29 is(
30    $cap,
31    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGO),
32    'SQL Logged'
33 );
34 $pp->query_end('SELECT * FROM frew WHERE id = 1');
35 is(
36    $cap,
37    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGOCLEAR),
38    'SQL Logged'
39 );
40
41 done_testing;