File: 03_trivial.t

package info (click to toggle)
liborlite-migrate-perl 1.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 248 kB
  • ctags: 152
  • sloc: perl: 1,885; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 778 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
36
37
38
#!/usr/bin/perl

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

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

# Check for migration patches
my $timeline = catdir( 't', 'data', 'trivial' );
ok( -d $timeline, 'Found timeline' );

# Set up the test database
my $file = test_db();

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

use strict;
use ORLite::Migrate {
	create       => 1,
	file         => '$file',
	timeline     => '$timeline',
	user_version => 3,
	prune        => 1,
};

1;
END_PERL

# The package should be migrated correctly
is( Foo::Bar->pragma('user_version'), 3, 'New database migrated ok' );
ok( Foo::Bar::Foo->can('count'), 'Created Foo table ok' );
is( Foo::Bar::Foo->count, 3, 'Found expected number of rows' );