File: 05_notables.t

package info (click to toggle)
liborlite-perl 1.97-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 524 kB
  • sloc: perl: 3,693; sql: 97; makefile: 2
file content (54 lines) | stat: -rw-r--r-- 959 bytes parent folder | download | duplicates (5)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl

# Tests both readonly functionality and version locking.

use strict;

BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More tests => 5;
use File::Spec::Functions ':ALL';
use t::lib::Test;

SCOPE: {
	# Test file
	my $file = test_db();

	# Connect
	my $dbh = connect_ok("dbi:SQLite:$file");
	$dbh->begin_work;
	$dbh->rollback;
	ok( $dbh->disconnect, 'disconnect' );
}

# Set up again
my $file = test_db();
my $dbh  = create_ok(
	file         => catfile(qw{ t 02_basics.sql }),
	connect      => [ "dbi:SQLite:$file" ],
	user_version => 10,
);

# Create the test package
eval <<"END_PERL"; die $@ if $@;
package Foo::Bar;

use strict;
use ORLite {
	file         => '$file',
	readonly     => 1,
	user_version => 10,
	tables       => 0,
};

1;
END_PERL

# Check the user_version value
is( Foo::Bar->pragma('user_version'), 10, '->user_version ok' );

# Check the ->count method
ok( ! defined &Foo::Bar::TableOne::count, 'Table package was not created' );