test => '-between with two literal sql arguments',
},
{
+ where => { x => { -between => [ \['current_date - ?', 1], \['current_date - ?', 0] ] } },
+ stmt => 'WHERE (x BETWEEN current_date - ? AND current_date - ?)',
+ bind => [1, 0],
+ test => '-between with two literal sql arguments with bind',
+ },
+ {
where => { x => { -between => \['? AND ?', 1, 2] } },
stmt => 'WHERE (x BETWEEN ? AND ?)',
bind => [1,2],
test => '-between with literal sql with one placeholder and one literal arg (\["? AND \'something\'", scalar])',
},
{
- where => { x => { -between => \["'this' AND 'that'"] } },
+ where => { x => { -between => \"'this' AND 'that'" } },
stmt => "WHERE (x BETWEEN 'this' AND 'that')",
bind => [],
- test => '-between with literal sql with two literal args (\["\'this\' AND \'that\'"])',
+ test => '-between with literal sql with a literal (\"\'this\' AND \'that\'")',
},
);
-plan tests => @in_between_tests*3;
+plan tests => @in_between_tests*4;
for my $case (@in_between_tests) {
TODO: {
local $Data::Dumper::Terse = 1;
- my @w;
- local $SIG{__WARN__} = sub { push @w, @_ };
- my $sql = SQL::Abstract->new ($case->{args} || {});
- lives_ok (sub {
- my ($stmt, @bind) = $sql->where($case->{where});
- is_same_sql_bind(
- $stmt,
- \@bind,
- $case->{stmt},
- $case->{bind},
- )
- || diag "Search term:\n" . Dumper $case->{where};
- });
- is (@w, 0, $case->{test} || 'No warnings within in-between tests')
- || diag join "\n", 'Emitted warnings:', @w;
+ lives_ok (sub {
+
+ my @w;
+ local $SIG{__WARN__} = sub { push @w, @_ };
+ my $sql = SQL::Abstract->new ($case->{args} || {});
+ lives_ok (sub {
+ my ($stmt, @bind) = $sql->where($case->{where});
+ is_same_sql_bind(
+ $stmt,
+ \@bind,
+ $case->{stmt},
+ $case->{bind},
+ )
+ || diag "Search term:\n" . Dumper $case->{where};
+ });
+ is (@w, 0, $case->{test} || 'No warnings within in-between tests')
+ || diag join "\n", 'Emitted warnings:', @w;
+ }, "$case->{test} doesn't die");
}
}