use strict;
use warnings;
-use FindBin;
use B::Deparse;
-use File::Copy 'move';
use Scalar::Util 'weaken';
use Test::More;
use Test::Exception;
### Now, disconnect the dbh, and move the db file;
# create a new one full of garbage, prevent SQLite from connecting.
$schema->storage->_dbh->disconnect;
-move( $db_orig, $db_tmp )
+rename( $db_orig, $db_tmp )
or die "failed to move $db_orig to $db_tmp: $!";
open my $db_file, '>', $db_orig;
print $db_file 'THIS IS NOT A REAL DATABASE';
### Now, move the db file back to the correct name
unlink($db_orig) or die "could not delete $db_orig: $!";
-move( $db_tmp, $db_orig )
+rename( $db_tmp, $db_orig )
or die "could not move $db_tmp to $db_orig: $!";
### Try the operation again... this time, it should succeed