From: Norbert Buchmuller Date: Sun, 16 Nov 2008 21:20:57 +0000 (+0000) Subject: Converted all test cases where the tests are queued in an array to calculate the... X-Git-Tag: v1.70~261 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6dcf723cc8adc17b2af256c178dcde98a85dc86a;p=dbsrgits%2FSQL-Abstract.git Converted all test cases where the tests are queued in an array to calculate the test plan from the length of that array. --- diff --git a/t/00new.t b/t/00new.t index 5727478..eac01ee 100644 --- a/t/00new.t +++ b/t/00new.t @@ -6,13 +6,8 @@ use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 15; - -use_ok('SQL::Abstract'); - #LDNOTE: renamed all "bind" into "where" because that's what they are - my @handle_tests = ( #1 { @@ -110,6 +105,11 @@ my @handle_tests = ( }, ); + +plan tests => (1 + scalar(@handle_tests)); + +use_ok('SQL::Abstract'); + for (@handle_tests) { local $" = ', '; #print "creating a handle with args ($_->{args}): "; diff --git a/t/01generate.t b/t/01generate.t index 000d6f7..4d98bb7 100644 --- a/t/01generate.t +++ b/t/01generate.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 72; use SQL::Abstract; @@ -347,7 +346,8 @@ my @tests = ( }, ); -use Data::Dumper; + +plan tests => scalar(@tests) * 2; for (@tests) { local $"=', '; diff --git a/t/02where.t b/t/02where.t index 60cbf84..85a0e8b 100644 --- a/t/02where.t +++ b/t/02where.t @@ -6,8 +6,6 @@ use Test::More; use Test::Exception; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 18; - use SQL::Abstract; # Make sure to test the examples, since having them break is somewhat @@ -196,9 +194,11 @@ my @handle_tests = ( bind => [ $not_stringifiable ], }, - ); + +plan tests => scalar(@handle_tests) + 1; + for my $case (@handle_tests) { my $sql = SQL::Abstract->new; my($stmt, @bind) = $sql->where($case->{where}, $case->{order}); diff --git a/t/03values.t b/t/03values.t index 4e9056a..a75c216 100644 --- a/t/03values.t +++ b/t/03values.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 5; use SQL::Abstract; @@ -58,6 +57,9 @@ my @data = ( }, ); + +plan tests => scalar(@data); + # Note to self: I have no idea what this does anymore # It looks like a cool fucking segment of code though! # I just wish I remembered writing it... :-\ diff --git a/t/06order_by.t b/t/06order_by.t index 63bde18..440517f 100644 --- a/t/06order_by.t +++ b/t/06order_by.t @@ -61,11 +61,12 @@ my @cases = }, ); -my $sql = SQL::Abstract->new; -my $sqlq = SQL::Abstract->new({quote_char => '`'}); plan tests => (scalar(@cases) * 2); +my $sql = SQL::Abstract->new; +my $sqlq = SQL::Abstract->new({quote_char => '`'}); + for my $case( @cases){ is($sql->_order_by($case->{given}), $case->{expects}); is($sqlq->_order_by($case->{given}), $case->{expects_quoted}); diff --git a/t/07subqueries.t b/t/07subqueries.t index c53d5c7..85f973e 100644 --- a/t/07subqueries.t +++ b/t/07subqueries.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 5; use SQL::Abstract; @@ -79,6 +78,7 @@ push @tests, { }; +plan tests => scalar(@tests); for (@tests) { diff --git a/t/08special_ops.t b/t/08special_ops.t index 895c9c2..8739ad7 100644 --- a/t/08special_ops.t +++ b/t/08special_ops.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use SQL::Abstract::Test import => ['is_same_sql_bind']; -plan tests => 2; use SQL::Abstract; @@ -56,6 +55,8 @@ my @tests = ( ); +plan tests => scalar(@tests); + for (@tests) { my($stmt, @bind) = $sqlmaker->where($_->{where}, $_->{order});