File: 34tt-base.t

package info (click to toggle)
libsql-translator-perl 0.11011-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,380 kB
  • sloc: perl: 251,748; sql: 3,805; xml: 233; makefile: 7
file content (54 lines) | stat: -rw-r--r-- 1,307 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
53
54
#!/usr/bin/perl -w
# vim:filetype=perl

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

use strict;
use Test::More;
use Test::Exception;
use Test::SQL::Translator qw(maybe_plan);

BEGIN {
    maybe_plan(4, 'Template 2.20',
               'Test::Differences',
               'SQL::Translator::Parser::XML::SQLFairy')
}
use Test::Differences;

use SQL::Translator;
use FindBin qw/$Bin/;
# Access to test libs. We want Producer/BaseTest.pm from here.
use lib ("$Bin/lib");


# Parse the test XML schema
my $obj;
$obj = SQL::Translator->new(
    debug          => 0,
    show_warnings  => 0,
    add_drop_table => 1,
    from           => "XML-SQLFairy",
    filename       => "$Bin/data/xml/schema.xml",
    to             => "Producer::BaseTest::produce",
);
my $out;
lives_ok { $out = $obj->translate; }  "Translate ran";
is $obj->error, ''                   ,"No errors";
ok $out ne ""                        ,"Produced something!";
local $/ = undef; # slurp
eq_or_diff $out, <DATA>              ,"Output looks right";


__DATA__
Hello World
Tables: Basic, Another

Basic
------
Fields: id title description email explicitnulldef explicitemptystring emptytagdef another_id timest

Another
------
Fields: id num