File: 52_db_filename.t

package info (click to toggle)
libdbd-sqlite3-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,004 kB
  • sloc: ansic: 167,715; perl: 1,788; pascal: 277; makefile: 9
file content (35 lines) | stat: -rw-r--r-- 601 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
34
35
use strict;
use warnings;
use lib "t/lib";
use SQLiteTest qw/connect_ok @CALL_FUNCS requires_sqlite/;
use Test::More;

BEGIN { requires_sqlite('3.7.10') }

use if -d ".git", "Test::FailWarnings";

for my $func (@CALL_FUNCS) {
	{
		my $db = filename($func);
		ok !$db, "in-memory database";
	}

	{
		my $db = filename($func, dbfile => '');
		ok !$db, "temporary database";
	}

	{
		my $db = filename($func, dbfile => 'test.db');
		like $db => qr/test\.db[\d]*$/i, "test.db";
		unlink $db;
	}
}

sub filename {
	my $func = shift;
	my $dbh = connect_ok(@_);
	$dbh->$func('db_filename');
}

done_testing;