Commit | Line | Data |
cbceab6a |
1 | #!/usr/bin/perl |
2 | |
3 | use warnings; |
4 | use strict; |
9f25d3c5 |
5 | use Test::More; |
6 | use Test::SQL::Translator; |
cbceab6a |
7 | use FindBin qw/$Bin/; |
8 | |
9f25d3c5 |
9 | BEGIN { |
10 | maybe_plan(1, 'SQL::Translator::Parser::XML', |
11 | 'SQL::Translator::Producer::XML'); |
12 | } |
13 | |
cbceab6a |
14 | use SQL::Translator; |
15 | |
16 | # Producing a schema with a Translator different from the one the schema was |
17 | # generated should just work. After all the $schema object is just data. |
18 | |
19 | |
20 | my $base_file = "$Bin/data/xml/schema.xml"; |
21 | my $base_t = SQL::Translator->new; |
22 | $base_t->$_ (1) for qw/add_drop_table no_comments/; |
23 | |
24 | # create a base schema attached to $base_t |
25 | my $base_schema = $base_t->translate ( |
26 | parser => 'XML', |
27 | file => $base_file, |
28 | ) or die $base_t->error; |
29 | |
30 | # now create a new translator and try to feed it the same schema |
31 | my $new_t = SQL::Translator->new; |
32 | $new_t->$_ (1) for qw/add_drop_table no_comments/; |
33 | |
34 | my $sql = $new_t->translate ( |
35 | data => $base_schema, |
36 | producer => 'SQLite' |
37 | ); |
38 | |
e0d2b70b |
39 | TODO: { |
40 | local $TODO = 'This will probably not work before the rewrite'; |
41 | |
42 | like ( |
43 | $sql, |
aee4b66e |
44 | qr/^\s*CREATE TABLE/m, #assume there is at least one create table statement |
e0d2b70b |
45 | "Received some meaningful output from the producer", |
46 | ); |
47 | } |