File: 10-list_drivers.t

package info (click to toggle)
libtest-database-perl 1.112-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 272 kB
  • ctags: 83
  • sloc: perl: 637; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 973 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use warnings;
use Test::More;
use Test::Database;

# hardcoded sorted list of our drivers
my @all_drivers = sort qw( CSV DBM Pg SQLite SQLite2 mysql );

# intersection with DBI->available_drivers
my %all_drivers = map { $_ => 1 } @all_drivers;
my @available_drivers
    = sort grep { exists $all_drivers{$_} } DBI->available_drivers;

plan tests => 3;

# minimal setup
Test::Database->clean_config();
Test::Database->load_drivers();

# existing Test::Database::Driver:: drivers
is_deeply( [ Test::Database->list_drivers('all') ],
    \@all_drivers, q{list_drivers('all')} );

# available DBI drivers
is_deeply( [ Test::Database->list_drivers('available') ],
    \@available_drivers, q{list_drivers('available')} );

# available DBI drivers we could load (should only be file-based)
my @filebased
    = grep { "Test::Database::Driver::$_"->is_filebased() } @available_drivers;
is_deeply( [ Test::Database->list_drivers() ], \@filebased,
    'list_drivers()' );