X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finflate%2Fdatetime_sybase.t;h=ab641361adf0634666ee4853f5c628b455f020e1;hb=d9672fb94b70dac86a6d4fed7ad46a48c5ee4527;hp=2b1fbedd0a46201152843c4d4bbdba283430e511;hpb=6469dabf60e2e7f7ca05122ec8bd4497e07bab2f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/inflate/datetime_sybase.t b/t/inflate/datetime_sybase.t index 2b1fbed..ab64136 100644 --- a/t/inflate/datetime_sybase.t +++ b/t/inflate/datetime_sybase.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use Test::Exception; @@ -12,13 +12,11 @@ if (not ($dsn && $user)) { plan skip_all => 'Set $ENV{DBICTEST_SYBASE_DSN}, _USER and _PASS to run this test' . "\nWarning: This test drops and creates a table called 'track'"; -} else { - eval "use DateTime; use DateTime::Format::Sybase;"; - if ($@) { - plan skip_all => 'needs DateTime and DateTime::Format::Sybase for testing'; - } } +plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_ase') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_ase'); + my @storage_types = ( 'DBI::Sybase::ASE', 'DBI::Sybase::ASE::NoBindVars', @@ -46,7 +44,7 @@ for my $storage_type (@storage_types) { # minute precision ['SMALLDATETIME', 'small_dt', '2004-08-21T14:36:00.000Z'], ); - + for my $dt_type (@dt_types) { my ($type, $col, $sample_dt) = @$dt_type; @@ -70,7 +68,11 @@ SQL ->search({ trackid => $row->trackid }, { select => [$col] }) ->first ); - is( $row->$col, $dt, 'DateTime roundtrip' ); + is( $row->$col, $dt, "$type roundtrip" ); + + is( $row->$col->nanosecond, $dt->nanosecond, + 'fractional DateTime portion roundtrip' ) + if $dt->nanosecond > 0; } # test a computed datetime column