File: 100-parse-small-packages.t

package info (click to toggle)
libparse-dia-sql-perl 0.31-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 924 kB
  • sloc: perl: 3,865; makefile: 2
file content (52 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download | duplicates (7)
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
#   $Id: 100-parse-small-packages.t,v 1.2 2009/02/26 13:46:44 aff Exp $

use warnings;
use strict;

use Test::More;
use File::Spec::Functions;
use lib catdir qw ( blib lib );
use Data::Dumper;

plan tests => 7;

use_ok ('Parse::Dia::SQL');

my $diasql =  Parse::Dia::SQL->new( files => [catfile(qw(t data TestERD.dia))], db => 'db2' );
isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});

# Parse and convert
cmp_ok($diasql->convert(), q{==}, 1,q{Expect convert to return 1});

# check that nodelists returns array of XML::DOM::NodeList
my $nodelists = $diasql->_get_nodelists();
foreach my $nodelist (@{$nodelists}){
  isa_ok($nodelist, q{XML::DOM::NodeList});
}

my $expected = [
  {
    'oracle,postgres,db2:pre' => '-- statements to do BEFORE creating
-- the tables (schema)
drop sequence imageInfo_id;
create sequence imageInfo_id;'
  },
  {
    'oracle,postgres,db2:post' => '-- statements to do AFTER creating
-- the tables (schema)
--drop trigger . . . .
--create trigger . . . .'
  },
  ];

# Check contents of small packages
my $smallpackages_ref = $diasql->get_smallpackages_ref();
#diag(Dumper($smallpackages_ref));

isa_ok($smallpackages_ref, 'ARRAY');
is_deeply($smallpackages_ref, $expected, q{Expect arrayref of hashrefs});



__END__