Subject: | minor bug in test |
Hi,
I've attached a patch to one of the test programs. One test was failing for me because (I think) SQL::Abstract has at some point slightly changed so that it was producing the 'like' operator in lowercase and now does it in uppercase.
I've changed the test to use a case-insensitive regex instead of an exact string match. I've also tweaked all the tests to use more of the Test::More features, because that helps in debugging test failures (better output about what failed and why).
hope that helps.
qef
--- t/03sql.t.orig 2004-07-01 23:17:29.000000000 +0100
+++ t/03sql.t 2005-05-01 04:38:40.092564103 +0100
@@ -30,18 +30,18 @@
my ( @bind_params ) = __PACKAGE__->count_search_where(
{ artist => 'Frank Zappa'
} );
-ok( $main::sql eq "SELECT COUNT(*)\nFROM __TABLE__\nWHERE ( artist = ? )\n"
+like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( artist = \? \)\n/i
, 'sql statement 1'
);
-ok( eq_array( \@bind_params, [ 'Frank Zappa' ] ), 'bind param list 1' );
+is_deeply( \@bind_params, [ 'Frank Zappa' ], 'bind param list 1' );
( @bind_params ) = __PACKAGE__->count_search_where(
{ artist => 'Frank Zappa'
, title => { like => '%Shut Up \'n Play Yer Guitar%' }
, release => { between => [ 1980, 1982 ] }
} );
-ok( $main::sql eq "SELECT COUNT(*)\nFROM __TABLE__\nWHERE ( artist = ? AND release BETWEEN ? AND ? AND title like ? )\n"
+like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( artist = \? AND release BETWEEN \? AND \? AND title LIKE \? \)\n/i
, 'sql statement 2'
);
-ok( eq_array( \@bind_params, [ 'Frank Zappa', 1980, 1982, '%Shut Up \'n Play Yer Guitar%' ] ), 'bind param list 2' );
+is_deeply( \@bind_params, [ 'Frank Zappa', 1980, 1982, '%Shut Up \'n Play Yer Guitar%' ], 'bind param list 2' );
__END__