DBIO-SQLite
view release on metacpan or search on metacpan
t/35exception_inaction.t view on Meta::CPAN
open(my $stderr_copy, '>&', *STDERR) or die "Unable to dup STDERR: $!";
my $tf = File::Temp->new( UNLINK => 1 );
my $output;
ESCAPE:
{
my $guard = scope_guard {
close STDERR;
open(STDERR, '>&', $stderr_copy);
$output = do { local (@ARGV, $/) = $tf; <> };
close $tf;
unlink $tf;
undef $tf;
close $stderr_copy;
};
close STDERR;
open(STDERR, '>&', $tf) or die "Unable to reopen STDERR: $!";
$schema->storage->ensure_connected;
t/populate_more.t view on Meta::CPAN
use DBIO::Util qw(file_path parent_dir);
# Deploy with our own schema class
my $db_file = ':memory:';
my $schema = PopulateMoreTest::Schema->connect("dbi:SQLite:$db_file", '', '', { AutoCommit => 1 });
# Deploy the tables we need
$schema->storage->dbh_do(sub {
my ($storage, $dbh) = @_;
my $sql_file = file_path(parent_dir(__FILE__), 'lib', 'sqlite.sql');
my $sql = do { local (@ARGV, $/) = $sql_file; <> };
for my $chunk (split(/;\s*\n+/, $sql)) {
if ($chunk =~ /^\s*(?!--\s*)\S/m) {
eval { $dbh->do($chunk) };
}
}
});
# Test basic populate_more with cross-source references
lives_ok {
$schema->populate_more([
( run in 2.478 seconds using v1.01-cache-2.11-cpan-a9496e3eb41 )