X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ficdt%2Fengine_specific%2Fsqlanywhere.t;h=00e9d563de9f683bd7d1bf8bf469b6a6d3c3932e;hb=e2741c7fd695dca054614f297b01d351a45bbf38;hp=676665f261dfa4279be3a57efb7607acd43e9ce2;hpb=8548e45cbaa8d8862ca78f675c73398ec2b0dc1d;p=dbsrgits%2FDBIx-Class.git diff --git a/t/icdt/engine_specific/sqlanywhere.t b/t/icdt/engine_specific/sqlanywhere.t index 676665f..00e9d56 100644 --- a/t/icdt/engine_specific/sqlanywhere.t +++ b/t/icdt/engine_specific/sqlanywhere.t @@ -1,36 +1,26 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } +use DBIx::Class::Optional::Dependencies -skip_all_without => qw( ic_dt _rdbms_sqlanywhere_common ); + use strict; use warnings; use Test::More; -use Scope::Guard (); -use DBIx::Class::Optional::Dependencies (); -use lib qw(t/lib); +use DBIx::Class::_Util 'scope_guard'; + use DBICTest; +my @tdeps = qw( test_rdbms_sqlanywhere test_rdbms_sqlanywhere_odbc ); +plan skip_all => 'Test needs ' . (join ' OR ', map + { "[ @{[ DBIx::Class::Optional::Dependencies->req_missing_for( $_ ) ]} ]" } + @tdeps +) unless scalar grep + { DBIx::Class::Optional::Dependencies->req_ok_for( $_ ) } + @tdeps +; + my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SQLANYWHERE_${_}" } qw/DSN USER PASS/}; my ($dsn2, $user2, $pass2) = @ENV{map { "DBICTEST_SQLANYWHERE_ODBC_${_}" } qw/DSN USER PASS/}; -plan skip_all => 'Test needs ' . - (join ' and ', map { $_ ? $_ : () } - DBIx::Class::Optional::Dependencies->req_missing_for('test_dt'), - (join ' or ', map { $_ ? $_ : () } - DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_sqlanywhere'), - DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_sqlanywhere_odbc'))) - unless - DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt') && ( - $dsn && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_sqlanywhere') - or - $dsn2 && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_sqlanywhere_odbc')) - or (not $dsn || $dsn2); - -if (not ($dsn || $dsn2)) { - plan skip_all => <<'EOF'; -Set $ENV{DBICTEST_SQLANYWHERE_DSN} and/or $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN} -_USER and _PASS to run this test'. -Warning: This test drops and creates a table called 'event'"; -EOF -} - my @info = ( [ $dsn, $user, $pass ], [ $dsn2, $user2, $pass2 ], @@ -49,7 +39,7 @@ foreach my $info (@info) { on_connect_call => 'datetime_setup', }); - my $sg = Scope::Guard->new(sub { cleanup($schema) } ); + my $sg = scope_guard { cleanup($schema) }; eval { $schema->storage->dbh->do('DROP TABLE event') }; $schema->storage->dbh->do(<<"SQL");