Improve trigger 'scope' attribute support (RT#119997)
[dbsrgits/SQL-Translator.git] / t / 35-access-parser.t
CommitLineData
20b9b675 1#!/usr/bin/perl
2# vim: set ft=perl:
3#
4
5use strict;
6
7use FindBin '$Bin';
8use Test::More 'no_plan';
9use SQL::Translator;
10use SQL::Translator::Schema::Constants;
6fedb92b 11use Test::SQL::Translator qw(maybe_plan table_ok);
20b9b675 12
13#BEGIN {
14# maybe_plan(180, "SQL::Translator::Parser::Access");
15# SQL::Translator::Parser::Access->import('parse');
16#}
17
18use SQL::Translator::Parser::Access 'parse';
19
20{
21 my $tr = SQL::Translator->new;
22
23 my $file = "$Bin/data/access/gdpdm.ddl";
24 open FH, "<$file" or die "Can't read '$file': $!\n";
25 local $/;
26 my $data = <FH>;
27 close FH;
28 my $val = parse($tr, $data);
29 ok( $val, 'Parsed OK' );
30
31 my $schema = $tr->schema;
6fedb92b 32 is( $schema->is_valid, 1, 'Schema is valid' );
20b9b675 33 my @tables = $schema->get_tables;
34 is( scalar @tables, 24, 'Right number of tables (24)' );
35
6fedb92b 36 my @tblnames = map {$_->name} @tables;
37 is_deeply( \@tblnames,
38 [qw/div_aa_annotation div_allele div_allele_assay div_annotation_type div_exp_entry div_experiment div_generation div_locality div_locus div_marker div_obs_unit div_obs_unit_sample div_passport div_poly_type div_statistic_type div_stock div_stock_parent div_trait div_trait_uom div_treatment div_treatment_uom div_unit_of_measure qtl_trait_ontology qtl_treatment_ontology/]
39 ,"tables");
40
41 table_ok( $schema->get_table("div_aa_annotation"), {
42 name => "div_aa_annotation",
43 fields => [
44 {
45 name => "div_aa_annotation_id",
46 data_type => "Long Integer",
47 size => 4,
48 },
49 {
50 name => "div_annotation_type_id",
51 data_type => "Long Integer",
52 size => 4,
53 },
54 {
55 name => "div_allele_assay_id",
56 data_type => "Long Integer",
57 size => 4,
58 },
59 {
60 name => "annotation_value",
61 data_type => "Text",
62 size => 50,
63 },
64 ],
65 });
66
67 table_ok( $schema->get_table("div_allele"), {
68 name => "div_allele",
69 fields => [
70 {
71 name => "div_allele_id",
72 data_type => "Long Integer",
73 size => 4,
74 },
75 {
76 name => "div_obs_unit_sample_id",
77 data_type => "Long Integer",
78 size => 4,
79 },
80 {
81 name => "div_allele_assay_id",
82 data_type => "Long Integer",
83 size => 4,
84 },
85 {
86 name => "allele_num",
87 data_type => "Long Integer",
88 size => 4,
89 },
90 {
91 name => "quality",
92 data_type => "Long Integer",
93 size => 4,
94 },
95 {
96 name => "value",
97 data_type => "Text",
98 size => 50,
99 },
100 ],
101 });
20b9b675 102}