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