Add renamed_from to tables.
[dbsrgits/SQL-Translator.git] / t / 05bgep-re.t
CommitLineData
35bab742 1#!/usr/bin/perl
2# vim: set ft=perl:
3#
4
5use strict;
dd2ef5ae 6
5dada97b 7use File::Spec::Functions qw(catfile tmpdir);
8use File::Temp qw(tempfile);
9use FindBin qw($Bin);
10use SQL::Translator;
2d691ec1 11use Test::More;
12use Test::SQL::Translator qw(maybe_plan);
5dada97b 13
fbc0552f 14# This aggravates me; XML::Writer produces tons of warnings.
15local $SIG{__WARN__} = sub {
16 CORE::warn(@_)
17 unless $_[0] =~ m#XML/Writer#;
18};
19
2d691ec1 20BEGIN {
21 maybe_plan(2,
22 'SQL::Translator::Parser::MySQL',
23 'SQL::Translator::Producer::XML::SQLFairy');
24}
25
5dada97b 26my @data = qw(data mysql BGEP-RE-create.sql);
27my $test_data = (-d "t")
28 ? catfile($Bin, @data)
29 : catfile($Bin, "t", @data);
30
02069e40 31my $tr = SQL::Translator->new(
32 parser => 'MySQL',
295fe54d 33 producer => 'XML-SQLFairy',
02069e40 34 filename => $test_data
35);
5dada97b 36my $data = $tr->translate;
37
295fe54d 38ok($data, "MySQL->XML-SQLFairy");
5dada97b 39
40SKIP: {
41 eval {
42 require XML::Parser;
43 };
44 if ($@) {
45 skip "Can't load XML::Parser" => 1;
46 }
47
48 # Can't get XML::Parser::parsestring to do Useful Things
49 my ($fh, $fname) = tempfile('sqlfXXXX',
50 UNLINK => 1,
51 SUFFIX => '.xml',
52 DIR => tmpdir);
53 print $fh $data;
54 $fh->close;
55
56 ok(XML::Parser->new->parsefile($fname),
57 "Successfully parsed output");
58}