Robustify the tests a little.
[dbsrgits/SQL-Translator.git] / t / 10excel.t
index 203d511..7bee0de 100644 (file)
@@ -1,11 +1,21 @@
 #!/usr/bin/perl
 # vim: set ft=perl:
 
-use Test::More tests => 31;
+use Test::More;
 use SQL::Translator;
-use SQL::Translator::Parser::Excel 'parse';
 use SQL::Translator::Schema::Constants;
 
+eval {
+    require SQL::Translator::Parser::Excel;
+    SQL::Translator::Parser::Excel->import('parse');
+};
+if ($@) {
+    plan skip_all => "$@";
+}
+else {
+    plan tests => 31;
+}
+
 my $tr     = SQL::Translator->new(parser => "Excel");
 my $t      = $tr->translate(filename => "t/data/Excel/t.xls");
 my $schema = $tr->schema;
@@ -33,20 +43,20 @@ is( $f2->is_primary_key, 0, 'Field is not PK' );
 
 my $f3 = shift @fields;
 is( $f3->name, 'number', 'Third field name is "number"' );
-is( lc $f3->data_type, 'varchar', 'Data type is "VARCHAR"' );
-is( $f3->size, 255, 'Size is "255"' );
+is( lc $f3->data_type, 'integer', 'Data type is "integer"' );
+is( $f3->size, 1, 'Size is "1"' );
 is( $f3->is_primary_key, 0, 'Field is not PK' );
 
 my $f4 = shift @fields;
 is( $f4->name, 'math', 'Fourth field name is "math"' );
-is( lc $f4->data_type, 'integer', 'Data type is "ingeger"' );
-is( $f4->size, 2, 'Size is "2"' );
+is( lc $f4->data_type, 'float', 'Data type is "float"' );
+is( $f4->size, '3,1', 'Size is "3,1"' );
 is( $f4->is_primary_key, 0, 'Field is not PK' );
 
 my $f5 = shift @fields;
 is( $f5->name, 'bitmap', 'Fifth field name is "bitmap"' );
-is( lc $f5->data_type, 'varchar', 'Data type is "VARCHAR"' );
-is( $f5->size, 255, 'Size is "255"' );
+is( lc $f5->data_type, 'char', 'Data type is "char"' );
+is( $f5->size, 1, 'Size is "1"' );
 is( $f5->is_primary_key, 0, 'Field is not PK' );
 
 my $f6 = shift @fields;