[Bast-commits] r5789 - SQL-Abstract/1.x/trunk/t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sat Mar 21 16:20:11 GMT 2009
Author: ribasushi
Date: 2009-03-21 16:20:11 +0000 (Sat, 21 Mar 2009)
New Revision: 5789
Added:
SQL-Abstract/1.x/trunk/t/04modifiers.t
Log:
Framework for modifiers tests
Added: SQL-Abstract/1.x/trunk/t/04modifiers.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/04modifiers.t (rev 0)
+++ SQL-Abstract/1.x/trunk/t/04modifiers.t 2009-03-21 16:20:11 UTC (rev 5789)
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+use SQL::Abstract::Test import => ['is_same_sql_bind'];
+
+use Data::Dumper;
+use SQL::Abstract;
+
+=begin
+Test -and -or and -nest/-nestX modifiers, assuming the following:
+
+ * Modifiers are respected in both hashrefs and arrayrefs (with the obvious limitation of one modifier type per hahsref)
+ * Each modifier affects only the immediate element following it
+ * In the case of -nestX simply wrap whatever the next element is in a pair of (), regardless of type
+ * In the case of -or/-and explicitly setting the logic within a following hashref or arrayref,
+ without imposing the logic on any sub-elements of the affected structure
+ * Ignore (maybe throw exception?) of the -or/-and modifier if the following element is missing,
+ or is of a type other than hash/arrayref
+
+=cut
+
+
+my @handle_tests = ();
+
+plan tests => @handle_tests * 2;
+
+for my $case (@handle_tests) {
+ local $Data::Dumper::Terse = 1;
+ my $sql = SQL::Abstract->new;
+ my($stmt, @bind);
+ lives_ok (sub {
+ ($stmt, @bind) = $sql->where($case->{where}, $case->{order});
+ is_same_sql_bind($stmt, \@bind, $case->{stmt}, $case->{bind})
+ || diag "Search term:\n" . Dumper $case->{where};
+ });
+}
Property changes on: SQL-Abstract/1.x/trunk/t/04modifiers.t
___________________________________________________________________
Name: svn:executable
+ *
More information about the Bast-commits
mailing list