X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FTest.pm;h=d55f3a859f2df7d876706eab07a39aedf585d4f5;hb=5aad8cf3d200d1538a5fad5b01895e1ccd3da80a;hp=916ad6dd6df8f969e8c310031a561ce0dfc30ad9;hpb=311b2151b1bb7ecb9cb2ad52f9bc5cbe73f3578d;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index 916ad6d..d55f3a8 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -2,8 +2,7 @@ package SQL::Abstract::Test; # see doc at end of file use strict; use warnings; -use Test::More; -use base 'Exporter'; +use base qw/Test::Builder::Module Exporter/; use Data::Dumper; use Carp; @@ -12,6 +11,7 @@ our @EXPORT_OK = qw/&is_same_sql_bind &eq_sql &eq_bind our $case_sensitive = 0; our $sql_differ; # keeps track of differing portion between SQLs +our $tb = __PACKAGE__->builder; sub is_same_sql_bind { my ($sql1, $bind_ref1, $sql2, $bind_ref2, $msg) = @_; @@ -23,21 +23,21 @@ sub is_same_sql_bind { my $same_bind = eq_bind($bind_ref1, $bind_ref2); # call Test::More::ok - ok($same_sql && $same_bind, $msg); + $tb->ok($same_sql && $same_bind, $msg); # add debugging info if (!$same_sql) { - diag "SQL expressions differ\n" + $tb->diag("SQL expressions differ\n" ." got: $sql1\n" ."expected: $sql2\n" - ."differing in :\n$sql_differ\n"; - ; + ."differing in :\n$sql_differ\n" + ); } if (!$same_bind) { - diag "BIND values differ\n" + $tb->diag("BIND values differ\n" ." got: " . Dumper($bind_ref1) ."expected: " . Dumper($bind_ref2) - ; + ); } } @@ -160,7 +160,7 @@ SQL::Abstract::Test - Helper function for testing SQL::Abstract use SQL::Abstract; use Test::More; - use SQL::Abstract::Test qw/is_same_sql_bind/; + use SQL::Abstract::Test import => ['is_same_sql_bind']; my ($sql, @bind) = SQL::Abstract->new->select(%args); is_same_sql_bind($given_sql, \@given_bind,