[Jifty-commit] r6471 - Jifty-DBI/branches/tisql/t/tisql

Jifty commits jifty-commit at lists.jifty.org
Thu Feb 26 06:07:03 EST 2009


Author: ruz
Date: Thu Feb 26 06:07:03 2009
New Revision: 6471

Modified:
   Jifty-DBI/branches/tisql/t/tisql/add_reference.t
   Jifty-DBI/branches/tisql/t/tisql/bench_tags.t
   Jifty-DBI/branches/tisql/t/tisql/column_refers_tisql.t
   Jifty-DBI/branches/tisql/t/tisql/joins_tags.t
   Jifty-DBI/branches/tisql/t/tisql/searches_basic.t
   Jifty-DBI/branches/tisql/t/tisql/searches_placeholders.t

Log:
* update tests

Modified: Jifty-DBI/branches/tisql/t/tisql/add_reference.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/add_reference.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/add_reference.t	Thu Feb 26 06:07:03 2009
@@ -130,8 +130,8 @@
 q{
 CREATE TEMPORARY table user_to_groups (
     id integer primary key AUTO_INCREMENT,
-    user_id  integer,
-    group_id integer
+    person integer,
+    grp integer
 ) },
 q{
 CREATE TEMPORARY table groups (
@@ -151,8 +151,8 @@
 q{
 CREATE TEMPORARY table user_to_groups (
     id serial primary key,
-    user_id integer,
-    group_id integer
+    person integer,
+    grp integer
 ) },
 q{
 CREATE TEMPORARY table groups (
@@ -171,8 +171,8 @@
     "CREATE SEQUENCE user_to_groups_seq",
     "CREATE table user_to_groups (
         id integer CONSTRAINT user_to_groups_Key PRIMARY KEY,
-        user_id integer,
-        group_id integer
+        person integer,
+        grp integer
     )",
     "CREATE SEQUENCE groups_seq",
     "CREATE table groups (

Modified: Jifty-DBI/branches/tisql/t/tisql/bench_tags.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/bench_tags.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/bench_tags.t	Thu Feb 26 06:07:03 2009
@@ -9,7 +9,7 @@
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
 
-use constant TESTS_PER_DRIVER => 1;
+use constant TESTS_PER_DRIVER => 5;
 
 my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
 plan tests => $total;

Modified: Jifty-DBI/branches/tisql/t/tisql/column_refers_tisql.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/column_refers_tisql.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/column_refers_tisql.t	Thu Feb 26 06:07:03 2009
@@ -65,7 +65,8 @@
     ok $user->id, "loaded bob's record";
     my $attrs = $user->attrs;
     $attrs->order_by(column => 'value', order => 'asc');
-    is $attrs->count, 3, "found three bob's attribute";
+    is $attrs->count, 3, "found three bob's attribute"
+        or diag "bad sql query: ". $attrs->build_select_query;
     is $attrs->next->value, 'bar', "correct value";
     is $attrs->next->value, 'foo', "correct value";
     is $attrs->next->value, 'zoo', "correct value";

Modified: Jifty-DBI/branches/tisql/t/tisql/joins_tags.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/joins_tags.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/joins_tags.t	Thu Feb 26 06:07:03 2009
@@ -9,7 +9,7 @@
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
 
-use constant TESTS_PER_DRIVER => 299;
+use constant TESTS_PER_DRIVER => 29;
 
 my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
 plan tests => $total;
@@ -18,6 +18,9 @@
 
 foreach my $d ( @available_drivers ) {
 SKIP: {
+    if ( $d eq 'SQLite' ) {
+        skip "SQLite is not yet supported", TESTS_PER_DRIVER;
+    }
     unless( has_schema( 'TestApp', $d ) ) {
         skip "No schema for '$d' driver", TESTS_PER_DRIVER;
     }
@@ -39,32 +42,38 @@
         ok( $count,  "init data" );
     }
 
-    my $clean_obj = TestApp::TagCollection->new( handle => $handle );
-#    my $clean_obj = TestApp::NodeCollection->new( handle => $handle );
+#    my $clean_obj = TestApp::TagCollection->new( handle => $handle );
+    my $clean_obj = TestApp::NodeCollection->new( handle => $handle );
+
+    local $SIG{INT} = sub { die Carp::confess("interrupted") };
 
     #diag Dumper( $clean_obj->tisql->describe_join($clean_obj => 'nodes') );
-    {
-        my $description = $clean_obj->tisql->describe_join($clean_obj => 'node');
-        diag Dumper( $description );
-        my $linear = $clean_obj->tisql->linearize_join( $description );
-        diag Dumper( $linear );
-        $linear = $clean_obj->tisql->linearize_join( $description, 'right<-left' );
-        diag Dumper( $linear );
-    }
-    exit;
+#    {
+#        my $description = $clean_obj->tisql->describe_join($clean_obj => 'nodes');
+#        diag Dumper( $description );
+#        my $linear = $clean_obj->tisql->linearize_join( $description );
+#        diag Dumper( $linear );
+#        $linear = $clean_obj->tisql->linearize_join( $description, 'right<-left' );
+#        diag Dumper( $linear );
+#    }
 
     my $nodes_obj = $clean_obj->clone;
     is_deeply( $nodes_obj, $clean_obj, 'after Clone looks the same');
 
     run_our_cool_tests(
         $nodes_obj,
-        # crazy things
-### XXX, TODO, FIXME
-        # get all nodes that have intersection in tags with article #3 (at)
-        ".tags.nodes.id = 3" => [qw(at mt)],
-        # get all nodes that have intersactions in tags with nodes that have tag 't'
-#        ".tags.nodes.tags.value = 't'" => [qw(at mt)],
 
+        # get all nodes that have intersection in tags with article #3 (article + x)
+        ".tags.nodes.id = 3" => [qw(ax axy axz axyz mx mxy mxz mxyz)],
+        
+        # get all nodes that have any intersections in tags with nodes that have tag 'x'
+        ".tags.nodes.tags.value = 'x'" => [qw(ax ay az axy axz ayz axyz mx my mz mxy mxz myz mxyz)],
+
+        # get all nodes that have no intersections in tags with article #3 (article + x)
+        ".tags.nodes.id != 3" => [qw(a aa ay az ayz m mm my mz myz)],
+
+        # get all nodes that have no intersections in tags with article #3 (article + x)
+        ".tags.nodes.type != 'article'" => [qw(a m mm)],
     );
 
     cleanup_schema( 'TestApp', $handle );
@@ -104,6 +113,7 @@
     }
     return run_our_cool_tests( $collection, 1, %tests ) unless $bundling;
 }
+
 1;
 
 
@@ -170,13 +180,23 @@
 
     [ 'article', 'a' ],
     [ 'article', 'aa' ],
-    [ 'article', 'at' ],
+    [ 'article', 'ax' ],
+    [ 'article', 'ay' ],
+    [ 'article', 'az' ],
     [ 'article', 'axy' ],
+    [ 'article', 'axz' ],
+    [ 'article', 'ayz' ],
+    [ 'article', 'axyz' ],
 
     [ 'memo', 'm' ],
     [ 'memo', 'mm' ],
-    [ 'memo', 'mt' ],
-    [ 'memo', 'mqwe' ],
+    [ 'memo', 'mx' ],
+    [ 'memo', 'my' ],
+    [ 'memo', 'mz' ],
+    [ 'memo', 'mxy' ],
+    [ 'memo', 'mxz' ],
+    [ 'memo', 'myz' ],
+    [ 'memo', 'mxyz' ],
     );
 }
 
@@ -193,27 +213,55 @@
 };
 }
 
-sub init_data {
-    return (
+sub init_data { return (
     [ 'node', 'value' ],
 
-#    [ 1, 'article', 'a' ],
-#    [ 2, 'article', 'aa' ],
+# 1   [ 'article', 'a' ],
+
+# 2   [ 'article', 'aa' ],
     [ 2, 'a' ],
-#    [ 3, 'article', 'at' ],
-    [ 3, 't' ],
-#    [ 4, 'article', 'axy' ],
-    [ 4, 'x' ],
+# 3   [ 'article', 'ax' ],
+    [ 3, 'x' ],
+# 4   [ 'article', 'ay' ],
     [ 4, 'y' ],
-#    [ 5, 'memo', 'm' ],
-#    [ 6, 'memo', 'mm' ],
-    [ 6, 'm' ],
-#    [ 7, 'memo', 'mt' ],
-    [ 7, 't' ],
-#    [ 8, 'memo', 'mqwe' ],
-    [ 8, 'q' ],
-    [ 8, 'w' ],
-    [ 8, 'e' ],
-    );
-}
+# 5   [ 'article', 'az' ],
+    [ 5, 'z' ],
+# 6   [ 'article', 'axy' ],
+    [ 6, 'x' ],
+    [ 6, 'y' ],
+# 7   [ 'article', 'axz' ],
+    [ 7, 'x' ],
+    [ 7, 'z' ],
+# 8   [ 'article', 'ayz' ],
+    [ 8, 'y' ],
+    [ 8, 'z' ],
+# 9   [ 'article', 'axyz' ],
+    [ 9, 'x' ],
+    [ 9, 'y' ],
+    [ 9, 'z' ],
+
+# 10  [ 'memo', 'm' ],
+
+# 11  [ 'memo', 'mm' ],
+    [ 11 , 'm' ],
+# 12  [ 'memo', 'mx' ],
+    [ 12 , 'x' ],
+# 13  [ 'memo', 'my' ],
+    [ 13, 'y' ],
+# 14  [ 'memo', 'mz' ],
+    [ 14, 'z' ],
+# 15  [ 'memo', 'mxy' ],
+    [ 15, 'x' ],
+    [ 15, 'y' ],
+# 16  [ 'memo', 'mxz' ],
+    [ 16, 'x' ],
+    [ 16, 'z' ],
+# 17  [ 'memo', 'myz' ],
+    [ 17, 'y' ],
+    [ 17, 'z' ],
+# 18  [ 'memo', 'mxyz' ],
+    [ 18, 'x' ],
+    [ 18, 'y' ],
+    [ 18, 'z' ],
+) }
 

Modified: Jifty-DBI/branches/tisql/t/tisql/searches_basic.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/searches_basic.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/searches_basic.t	Thu Feb 26 06:07:03 2009
@@ -123,7 +123,9 @@
 q{
 CREATE TEMPORARY table users (
     id integer primary key AUTO_INCREMENT,
-    login varchar(36)
+    test varchar(36),
+    login varchar(36),
+    name varchar(36)
 ) },
 ]
 }
@@ -133,7 +135,9 @@
 q{
 CREATE TEMPORARY table users (
     id serial primary key,
-    login varchar(36)
+    test varchar(36),
+    login varchar(36),
+    name varchar(36)
 ) },
 ]
 }
@@ -142,7 +146,9 @@
     "CREATE SEQUENCE users_seq",
     "CREATE table users (
         id integer CONSTRAINT users_Key PRIMARY KEY,
-        login varchar(36)
+        test varchar(36),
+        login varchar(36),
+        name varchar(36)
     )",
 ] }
 

Modified: Jifty-DBI/branches/tisql/t/tisql/searches_placeholders.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/tisql/searches_placeholders.t	(original)
+++ Jifty-DBI/branches/tisql/t/tisql/searches_placeholders.t	Thu Feb 26 06:07:03 2009
@@ -93,7 +93,9 @@
 q{
 CREATE TEMPORARY table users (
     id integer primary key AUTO_INCREMENT,
-    login varchar(36)
+    test varchar(36),
+    login varchar(36),
+    name varchar(36)
 ) },
 ]
 }
@@ -103,7 +105,9 @@
 q{
 CREATE TEMPORARY table users (
     id serial primary key,
-    login varchar(36)
+    test varchar(36),
+    login varchar(36),
+    name varchar(36)
 ) },
 ]
 }
@@ -112,7 +116,9 @@
     "CREATE SEQUENCE users_seq",
     "CREATE table users (
         id integer CONSTRAINT users_Key PRIMARY KEY,
-        login varchar(36)
+        test varchar(36),
+        login varchar(36),
+        name varchar(36)
     )",
 ] }
 


More information about the Jifty-commit mailing list