1#!/usr/bin/perl
2use strict;
3
4use FindBin qw/$Bin/;
5use Test::More;
6use Test::SQL::Translator;
7use Test::Exception;
8use Data::Dumper;
9use SQL::Translator;
10use SQL::Translator::Schema::Constants;
11
12BEGIN {
13    maybe_plan(2, 'SQL::Translator::Parser::YAML',
14                  'SQL::Translator::Producer::Oracle');
15}
16
17my $yamlfile = "$Bin/data/oracle/schema_with_options.yaml";
18
19my $sqlt;
20$sqlt = SQL::Translator->new(
21    show_warnings  => 0,
22    add_drop_table => 0,
23    producer_args  => { 'delay_constraints' => 1 },
24    quote_table_names => 0,
25    quote_field_names => 0,
26);
27
28my $sql_string = $sqlt->translate(
29    from     => 'YAML',
30    to       => 'Oracle',
31    filename => $yamlfile,
32);
33
34ok($sql_string, 'Translation successfull');
35ok($sql_string =~ /ADD CONSTRAINT pk_d_operator PRIMARY KEY/, 'constraints delayed');
36