X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F746db2_400.t;h=1ce3b99f99ec05f4a3665c1b0bb4abce31e2adf5;hb=5ff6d6034ddcb696d24c4b716b5c12f109004d1f;hp=e78418982a874ec393a922e1032c4c8664218748;hpb=c1cac6332247a092ddc886c52607b24104c3fb46;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/746db2_400.t b/t/746db2_400.t index e784189..1ce3b99 100644 --- a/t/746db2_400.t +++ b/t/746db2_400.t @@ -1,19 +1,17 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } +use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_db2_400'; + use strict; -use warnings; +use warnings; use Test::More; -use lib qw(t/lib); -use DBICTest; - -my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/}; -#warn "$dsn $user $pass"; +use DBICTest; # Probably best to pass the DBQ option in the DSN to specify a specific # libray. Something like: # DBICTEST_DB2_400_DSN='dbi:ODBC:dsn=MyAS400;DBQ=MYLIB' -plan skip_all => 'Set $ENV{DBICTEST_DB2_400_DSN}, _USER and _PASS to run this test' - unless ($dsn && $user); +my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/}; plan tests => 6; @@ -23,7 +21,13 @@ my $dbh = $schema->storage->dbh; eval { $dbh->do("DROP TABLE artist") }; -$dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10))"); +$dbh->do(<<''); +CREATE TABLE artist ( + artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + name VARCHAR(255), + rank INTEGER default 13 not null, + charfield CHAR(10) +) # Just to test loading, already in Core $schema->class('Artist')->load_components('PK::Auto'); @@ -58,10 +62,15 @@ my $test_type_info = { 'is_nullable' => 1, 'size' => 255 }, + 'rank' => { + 'data_type' => 'INTEGER', + 'is_nullable' => 0, + 'size' => 10, + }, 'charfield' => { 'data_type' => 'CHAR', 'is_nullable' => 1, - 'size' => 10 + 'size' => 10 }, }; @@ -71,6 +80,7 @@ is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); # clean up our mess END { - $dbh->do("DROP TABLE artist") if $dbh; + my $dbh = eval { $schema->storage->_dbh }; + $dbh->do("DROP TABLE artist") if $dbh; + undef $schema; } -