a couple more extra TODO tests for Sybase computed columns
Rafael Kitover [Sat, 30 Jan 2010 23:42:11 +0000 (23:42 +0000)]
t/15sybase_common.t

index 623af02..903592f 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use lib qw(t/lib);
 use dbixcsl_common_tests;
 use Test::More;
+use Test::Exception;
 
 my $dsn      = $ENV{DBICTEST_SYBASE_DSN} || '';
 my $user     = $ENV{DBICTEST_SYBASE_USER} || '';
@@ -25,7 +26,7 @@ my $tester = dbixcsl_common_tests->new(
             },
         ],
         drop  => [ qw/ sybase_loader_test1 / ],
-        count => 7,
+        count => 9,
         run   => sub {
             my ($schema, $monikers, $classes) = @_;
 
@@ -55,7 +56,7 @@ my $tester = dbixcsl_common_tests->new(
             {
                 local $TODO = 'constant DEFAULT introspection';
 
-                is $rsrc->column_info('charfield')->{default},
+                is $rsrc->column_info('charfield')->{default_value},
                     'foo',
                     'constant DEFAULT is correct';
             }
@@ -70,6 +71,22 @@ my $tester = dbixcsl_common_tests->new(
             or diag "Data type is: ",
                 $rsrc->column_info('computed_dt')->{data_type}
             ;
+
+            {
+                local $TODO = 'default_value for computed columns';
+
+                my $computed_dt_default =
+                    $rsrc->column_info('computed_dt')->{default_value};
+
+                ok ((ref $computed_dt_default eq 'SCALAR'),
+                    'default_value for computed column is a scalar ref')
+#                or diag "default_value is: ", $computed_dt_default
+                ;
+
+                eval { is $$computed_dt_default,
+                    'getdate()',
+                    'default_value for computed column is correct' };
+            }
         },
     },
 );