From: Ken Youens-Clark Date: Thu, 13 Aug 2009 15:55:03 +0000 (+0000) Subject: Added tests for RT#37814 (parsing of double quotes, autoincrement). X-Git-Tag: v0.11008~107 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=03d12def97d014fc5672c45909b59bc31bf85b15;p=dbsrgits%2FSQL-Translator.git Added tests for RT#37814 (parsing of double quotes, autoincrement). --- diff --git a/t/27sqlite-parser.t b/t/27sqlite-parser.t index 0540449..c221312 100644 --- a/t/27sqlite-parser.t +++ b/t/27sqlite-parser.t @@ -10,7 +10,7 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(9, + maybe_plan(12, 'SQL::Translator::Parser::SQLite'); } SQL::Translator::Parser::SQLite->import('parse'); @@ -32,6 +32,12 @@ my $file = "$Bin/data/sqlite/create.sql"; my $t1 = shift @tables; is( $t1->name, 'person', "'Person' table" ); + my @fields = $t1->get_fields; + is( scalar @fields, 6, 'Six fields in "person" table'); + my $fld1 = shift @fields; + is( $fld1->name, 'person_id', 'First field is "person_id"'); + is( $fld1->is_auto_increment, 1, 'Is an autoincrement field'); + my $t2 = shift @tables; is( $t2->name, 'pet', "'Pet' table" ); diff --git a/t/data/sqlite/create.sql b/t/data/sqlite/create.sql index d1a5323..f7a397f 100644 --- a/t/data/sqlite/create.sql +++ b/t/data/sqlite/create.sql @@ -1,7 +1,7 @@ create table person ( - person_id INTEGER PRIMARY KEY, - name varchar(20) not null, - age integer, + person_id INTEGER PRIMARY KEY AUTOINCREMENT, + 'name' varchar(20) not null, + 'age' integer, weight double(11,2), iq tinyint default '0', description text @@ -10,10 +10,10 @@ create table person ( create unique index u_name on person (name); create table pet ( - pet_id int, - person_id int references person (person_id), - name varchar(30), - age int, + "pet_id" int, + "person_id" int references person (person_id), + "name" varchar(30), + "age" int, check ( age < 100 ), primary key (pet_id, person_id) );