On Thu, 6 Nov 2008 10:41:53 +0100 "Dami Laurent (PJ)"
<[EMAIL PROTECTED]> wrote:

> c) there is a problem in SQL::Abstract::Test, because
> "is_same_sql_bind" does not detect when it is inside a TODO block

Converted to use Test::Builder, see the attached patch.

norbi
Index: t/07subqueries.t
===================================================================
--- t/07subqueries.t	(revision 5062)
+++ t/07subqueries.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 plan tests => 5;
 
 use SQL::Abstract;
Index: t/03values.t
===================================================================
--- t/03values.t	(revision 5062)
+++ t/03values.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 plan tests => 5;
 
 use SQL::Abstract;
Index: t/00new.t
===================================================================
--- t/00new.t	(revision 5062)
+++ t/00new.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 
 plan tests => 15;
 
Index: t/08special_ops.t
===================================================================
--- t/08special_ops.t	(revision 5062)
+++ t/08special_ops.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 plan tests => 2;
 
 use SQL::Abstract;
Index: t/01generate.t
===================================================================
--- t/01generate.t	(revision 5062)
+++ t/01generate.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 plan tests => 64;
 
 use SQL::Abstract;
Index: t/06order_by.t
===================================================================
--- t/06order_by.t	(revision 5062)
+++ t/06order_by.t	(working copy)
@@ -6,7 +6,7 @@
 
 use SQL::Abstract;
 
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 my @cases = 
   (
    {
Index: t/02where.t
===================================================================
--- t/02where.t	(revision 5062)
+++ t/02where.t	(working copy)
@@ -4,7 +4,7 @@
 use warnings;
 use Test::More;
 use Test::Exception;
-use SQL::Abstract::Test qw/is_same_sql_bind/;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
 
 plan tests => 17;
 
Index: lib/SQL/Abstract/Test.pm
===================================================================
--- lib/SQL/Abstract/Test.pm	(revision 5062)
+++ lib/SQL/Abstract/Test.pm	(working copy)
@@ -2,8 +2,7 @@
 
 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 $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 @@
   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 @@
 
   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,    [EMAIL PROTECTED], 
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to