Skip to content

Commit e954228

Browse files
committed
Fix tests for YAML parser and producer
1 parent eaacea1 commit e954228

File tree

4 files changed

+63
-4
lines changed

4 files changed

+63
-4
lines changed

t/24yaml.t

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/perl
12
use warnings;
23
use strict;
4+
use English '-no_match_vars';
35
use Test::More;
46
use Test::Exception;
57
use Test::SQL::Translator qw(maybe_plan);
@@ -12,10 +14,11 @@ BEGIN {
1214

1315
my $sqlt_version = $SQL::Translator::VERSION;
1416
use YAML qw(Load);
15-
my $yaml = Load(<<YAML);
17+
my $yaml = Load(<<"YAML");
1618
---
1719
schema:
1820
procedures: {}
21+
sequences: {}
1922
tables:
2023
person:
2124
constraints:
@@ -241,9 +244,10 @@ translator:
241244
YAML
242245

243246
my $file = "$Bin/data/sqlite/create.sql";
244-
open FH, "<$file" or die "Can't read '$file': $!\n";
245-
local $/;
246-
my $data = <FH>;
247+
open my $fh, '<', $file or die "Can't read '$file': $OS_ERROR\n";
248+
local $INPUT_RECORD_SEPARATOR = undef;
249+
my $data = <$fh>;
250+
close $fh or die "Can't close '$file': $OS_ERROR\n";
247251
my $tr = SQL::Translator->new(
248252
parser => 'SQLite',
249253
producer => 'YAML',

t/36-filters.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ my $sqlt_version = $SQL::Translator::VERSION;
6969
my $ans_yaml = qq{---
7070
schema:
7171
procedures: {}
72+
sequences: {}
7273
tables:
7374
GdayWorld:
7475
constraints: []

t/38-filter-names.t

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,61 @@ use SQL::Translator;
1919

2020
my $in_yaml = qq{---
2121
schema:
22+
sequences:
23+
IdentificationNumber:
24+
name: IdentificationNumber
25+
increment: 2
26+
order: 2
27+
BillingNumber:
28+
name: BillingNumber
29+
minvalue: 3
30+
maxvalue: 256
31+
order: 1
32+
owner: person.identification_number
2233
tables:
2334
Person:
2435
name: Person
2536
fields:
37+
identification_number:
38+
data_type: integer
39+
name: identification_number
40+
order: 1
2641
first_name:
2742
data_type: foovar
2843
name: first_name
44+
order: 2
2945
};
3046

3147
my $ans_yaml = qq{---
3248
schema:
3349
procedures: {}
50+
sequences:
51+
BillingNumber:
52+
cache: 0
53+
cycle: 0
54+
guarantee_order: 0
55+
increment: 0
56+
keep: 0
57+
maxvalue: 256
58+
minvalue: 3
59+
name: BillingNumber
60+
order: 1
61+
owner: person.identification_number
62+
start: 0
63+
temporary: 0
64+
IdentificationNumber:
65+
cache: 0
66+
cycle: 0
67+
guarantee_order: 0
68+
increment: 2
69+
keep: 0
70+
maxvalue: 0
71+
minvalue: 0
72+
name: IdentificationNumber
73+
order: 2
74+
owner: NONE
75+
start: 0
76+
temporary: 0
3477
tables:
3578
person:
3679
constraints: []
@@ -42,6 +85,16 @@ schema:
4285
is_primary_key: 0
4386
is_unique: 0
4487
name: First_name
88+
order: 2
89+
size:
90+
- 0
91+
Identification_number:
92+
data_type: integer
93+
default_value: ~
94+
is_nullable: 1
95+
is_primary_key: 0
96+
is_unique: 0
97+
name: Identification_number
4598
order: 1
4699
size:
47100
- 0

t/39-filter-globals.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ is_deeply(
8686
{
8787
schema => {
8888
procedures => {},
89+
sequences => {},
8990
tables => {
9091
Person => {
9192
constraints => [ {

0 commit comments

Comments
 (0)