File: 02_main.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 (52 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl

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

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

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

# Locate patches
my @patches = ORLite::Migrate::patches( $timeline );
is_deeply(
	\@patches,
	[ undef, 'migrate-1.pl', 'migrate-02.pl', 'migrate-03.pl' ],
	'Found the expected patch set',
);

# Find a plan
my @plan = ORLite::Migrate::plan( $timeline, 1 );
is_deeply(
	\@plan,
	[ 'migrate-02.pl', 'migrate-03.pl' ],
	'Found expected plan',
);

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

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

use strict;
use ORLite {
	file   => '$file',
	create => 1,
	prune  => 1,
};

1;
END_PERL

can_ok( 'Foo::Bar', 'do' );
can_ok( 'Foo::Bar', 'orlite' );