4d28b955b60f3481f7d6e7e18536866171809a6d
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / compat / 00new.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 use SQL::Abstract::Test import => ['is_same_sql_bind'];
6
7 #LDNOTE: renamed all "bind" into "where" because that's what they are
8
9 my @handle_tests = (
10     #2
11     {
12          args => {},
13          stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )'
14     }
15 );
16
17 plan tests => (1 + scalar(@handle_tests));
18
19 use_ok('SQL::Abstract::Compat');
20
21 for (@handle_tests) {
22   my $sql  = SQL::Abstract::Compat->new($_->{args});
23   my $where = $_->{where} || { a => 4, b => 0};
24   my($stmt, @bind) = $sql->select('test', '*', $where);
25
26
27   # LDNOTE: this original test suite from NWIGER did no comparisons
28   # on @bind values, just checking if @bind is nonempty.
29   # So here we just fake a [1] bind value for the comparison.
30   is_same_sql_bind($stmt, [@bind ? 1 : 0], $_->{stmt}, [1]);
31 }