From: Mark Addison Date: Thu, 7 Aug 2003 14:49:24 +0000 (+0000) Subject: Added BUG notes and test about single tags e.g. X-Git-Tag: v0.04~352 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FSQL-Translator.git;a=commitdiff_plain;h=b35303534de4c377a4c9dea7a5efb8dfcf759537 Added BUG notes and test about single tags e.g. --- diff --git a/lib/SQL/Translator/Parser/SqlfXML.pm b/lib/SQL/Translator/Parser/SqlfXML.pm index 4ec8df5..cb4fc48 100644 --- a/lib/SQL/Translator/Parser/SqlfXML.pm +++ b/lib/SQL/Translator/Parser/SqlfXML.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::SqlfXML; # ------------------------------------------------------------------- -# $Id: SqlfXML.pm,v 1.2 2003-08-06 22:08:16 grommit Exp $ +# $Id: SqlfXML.pm,v 1.3 2003-08-07 14:49:24 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Mark Addison , # @@ -59,13 +59,15 @@ tags or EMPTY_STRING for a zero lenth string. NULL for an explicit null EMPTY_STRING NULL + + =cut use strict; use warnings; use vars qw[ $DEBUG $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -176,10 +178,19 @@ __END__ =pod +=head1 BUGS + +B e.g. Will be parsed as "" and hence also +false. This is a bit counter intuative for some tags as seeing + you might think that it was set when it fact it wouldn't +be. So for now it is safest not to use them until their handling by the parser +is sorted out. + =head1 TODO * Support sqf:options. * Test forign keys are parsed ok. + * Sort out sane handling of vs vs it not being there. * Control over defaulting of non-existant tags. =head1 AUTHOR diff --git a/t/16xml-parser.t b/t/16xml-parser.t index be7372a..eee29df 100644 --- a/t/16xml-parser.t +++ b/t/16xml-parser.t @@ -10,7 +10,7 @@ # Tests that; # -use Test::More tests => 78; +use Test::More; use Test::Exception; use strict; @@ -68,6 +68,8 @@ sub test_field { # Testing 1,2,3,4... #============================================================================= +plan tests => 89; + use SQL::Translator; use SQL::Translator::Schema::Constants; @@ -97,9 +99,9 @@ is_deeply( \@tblnames, [qw/Basic/], "tables"); # Basic my $tbl = $scma->get_table("Basic"); is $tbl->order, 1, "Basic->order"; -is_deeply( [map {$_->name} $tbl->get_fields], - [qw/id title description email explicitnulldef explicitemptystring/] , - "Table Basic's fields"); +is_deeply( [map {$_->name} $tbl->get_fields], [qw/ + id title description email explicitnulldef explicitemptystring singletagdef +/] , "Table Basic's fields"); test_field($tbl->get_field("id"),{ name => "id", order => 1, @@ -148,6 +150,13 @@ test_field($tbl->get_field("explicitemptystring"),{ default_value => "", is_nullable => 1, }); +test_field($tbl->get_field("singletagdef"),{ + name => "singletagdef", + order => 7, + data_type => "varchar", + default_value => "", + is_nullable => 1, +}); my @indices = $tbl->get_indices; is scalar(@indices), 1, "Table basic has 1 index"; diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index a398f66..4f5f9d3 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -153,6 +153,21 @@ Fields extra: table: Basic + singletagdef + data_type: varchar + size: 0 + is_nullable: 1 + default_value: + is_primary_key: 0 + is_unique: 0 + is_auto_increment: 0 + is_foreign_key: 0 + foreign_key_reference: + is_valid: 1 + order: 7 + extra: + table: Basic + Indices titleindex diff --git a/t/data/xml/schema-basic.xml b/t/data/xml/schema-basic.xml index 949d1bf..21bfe73 100644 --- a/t/data/xml/schema-basic.xml +++ b/t/data/xml/schema-basic.xml @@ -53,7 +53,14 @@ Created on Fri Aug 1 11:24:58 2003 varchar 1 EMPTY_STRING - 5 + 6 + + + singletagdef + varchar + 1 + + 7