Lose yet another dep (Data::Dumper::Concise)
[dbsrgits/DBIx-Class.git] / t / prefetch / attrs_untouched.t
index 1742770..7b50344 100644 (file)
@@ -1,46 +1,27 @@
-use warnings;  
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+
+use warnings;
+use strict;
 
 use Test::More;
-use Test::Exception;
-use lib qw(t/lib);
+
 use DBICTest;
-use Data::Dumper;
+use DBIx::Class::_Util 'dump_value';
 
 my $schema = DBICTest->init_schema();
 
-my $orig_debug = $schema->storage->debug;
-
-use IO::File;
-
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 3 );
-}
-
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
-    split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
-    ( ($sqlite_major_ver < 3) ||
-      ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
-      ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
-    $is_broken_sqlite = 1;
-}
+plan tests => 3;
 
 # bug in 0.07000 caused attr (join/prefetch) to be modifed by search
 # so we check the search & attr arrays are not modified
 my $search = { 'artist.name' => 'Caterwauler McCrae' };
 my $attr = { prefetch => [ qw/artist liner_notes/ ],
              order_by => 'me.cdid' };
-my $search_str = Dumper($search);
-my $attr_str = Dumper($attr);
+my $search_str = dump_value $search;
+my $attr_str = dump_value $attr;
 
 my $rs = $schema->resultset("CD")->search($search, $attr);
 
-is(Dumper($search), $search_str, 'Search hash untouched after search()');
-is(Dumper($attr), $attr_str, 'Attribute hash untouched after search()');
+is( dump_value $search, $search_str, 'Search hash untouched after search()');
+is( dump_value $attr, $attr_str, 'Attribute hash untouched after search()');
 cmp_ok($rs + 0, '==', 3, 'Correct number of records returned');