X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04modifiers.t;h=3b024c399eeb703071bb40e8cecf3deea1617d21;hb=8fec3fd9f641021d7a90d45b8a7b6334f1bb1fad;hp=87ddbfce1bad986464cfa44a286f83a3407b5d71;hpb=8bbeb3e2fda0195a93e8edb8b0e4c2e3d81f73c5;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/04modifiers.t b/t/04modifiers.t index 87ddbfc..3b024c3 100644 --- a/t/04modifiers.t +++ b/t/04modifiers.t @@ -7,9 +7,10 @@ use Test::Exception; use SQL::Abstract::Test import => ['is_same_sql_bind']; use Data::Dumper; -use Storable qw/dclone/; use SQL::Abstract; +my $dclone = eval { require Storable; \&Storable::dclone }; + #### WARNING #### # # -nest has been undocumented on purpose, but is still supported for the @@ -380,8 +381,6 @@ my @nest_tests = ( }, ); -plan tests => @and_or_tests*4 + @numbered_mods*4 + @nest_tests*2; - for my $case (@and_or_tests) { TODO: { local $TODO = $case->{todo} if $case->{todo}; @@ -392,7 +391,9 @@ for my $case (@and_or_tests) { local $SIG{__WARN__} = sub { push @w, @_ }; my $sql = SQL::Abstract->new ($case->{args} || {}); - my $where_copy = dclone($case->{where}); + + my $where_copy = $dclone->($case->{where}) + if $dclone;; lives_ok (sub { my ($stmt, @bind) = $sql->where($case->{where}); @@ -407,7 +408,8 @@ for my $case (@and_or_tests) { is (@w, 0, 'No warnings within and-or tests') || diag join "\n", 'Emitted warnings:', @w; - is_deeply ($case->{where}, $where_copy, 'Where conditions unchanged'); + is_deeply ($case->{where}, $where_copy, 'Where conditions unchanged') + if $dclone; } } @@ -469,3 +471,4 @@ for my $case (@numbered_mods) { } } +done_testing;