X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F00new.t;h=5da3446cedadf6add33853f6322bc473a1e3967b;hb=46dc2f3e47d514cd376003cea2df63222c492b0b;hp=bbba6927da75e335b77e7242ed30ebddefe89ba5;hpb=2fadf08e171ee68c239cec896075428ae21f2232;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/00new.t b/t/00new.t index bbba692..5da3446 100644 --- a/t/00new.t +++ b/t/00new.t @@ -1,24 +1,14 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; -use SQL::Abstract::Test import => ['is_same_sql_bind']; - -#LDNOTE: renamed all "bind" into "where" because that's what they are +use SQL::Abstract::Test import => ['is_same_sql']; +use SQL::Abstract; my @handle_tests = ( #1 { args => {logic => 'OR'}, -# stmt => 'SELECT * FROM test WHERE ( a = ? OR b = ? )' -# LDNOTE: modified the line above (changing the test suite!!!) because -# the test was not consistent with the doc: hashrefs should not be -# influenced by the current logic, they always mean 'AND'. So -# { a => 4, b => 0} should ALWAYS mean ( a = ? AND b = ? ). -# -# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )' }, #2 @@ -39,9 +29,6 @@ my @handle_tests = ( #5 { args => {cmp => "=", logic => 'or'}, -# LDNOTE idem -# stmt => 'SELECT * FROM test WHERE ( a = ? OR b = ? )' -# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )' }, #6 @@ -52,9 +39,6 @@ my @handle_tests = ( #7 { args => {logic => "or", cmp => "like"}, -# LDNOTE idem -# stmt => 'SELECT * FROM test WHERE ( a LIKE ? OR b LIKE ? )' -# acked by RIBASUSHI stmt => 'SELECT * FROM test WHERE ( a LIKE ? AND b LIKE ? )' }, #8 @@ -101,20 +85,15 @@ my @handle_tests = ( }, ); - -use_ok('SQL::Abstract'); - for (@handle_tests) { - local $" = ', '; - #print "creating a handle with args ($_->{args}): "; - my $sql = SQL::Abstract->new($_->{args}); - my $where = $_->{where} || { a => 4, b => 0}; - my($stmt, @bind) = $sql->select('test', '*', $where); + my $sqla = SQL::Abstract->new($_->{args}); + my($stmt) = $sqla->select( + 'test', + '*', + $_->{where} || { a => 4, b => 0} + ); - # LDNOTE: this original test suite from NWIGER did no comparisons - # on @bind values, just checking if @bind is nonempty. - # So here we just fake a [1] bind value for the comparison. - is_same_sql_bind($stmt, [@bind ? 1 : 0], $_->{stmt}, [1]); + is_same_sql($stmt, $_->{stmt}); } done_testing;