From: Ken Youens-Clark Date: Wed, 8 Oct 2003 22:38:26 +0000 (+0000) Subject: Basic tests for SQLite, will expand later. X-Git-Tag: v0.04~101 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=153b2e77e3d34b03c17c97a9bad1ba1b1ebc4340;p=dbsrgits%2FSQL-Translator.git Basic tests for SQLite, will expand later. --- diff --git a/t/27sqlite-parser.t b/t/27sqlite-parser.t index 8d61c59..db4c40c 100644 --- a/t/27sqlite-parser.t +++ b/t/27sqlite-parser.t @@ -2,12 +2,36 @@ # vim: set ft=perl: use strict; - use Test::More 'no_plan'; #tests => 180; +use FindBin qw/$Bin/; + use SQL::Translator; -use SQL::Translator::Parser::SQLite qw(parse); +use SQL::Translator::Parser::SQLite 'parse'; use SQL::Translator::Schema::Constants; +my $file = "$Bin/data/sqlite/create.sql"; + { + local $/; + open my $fh, "<$file" or die "Can't read file '$file': $!\n"; + my $data = <$fh>; my $t = SQL::Translator->new; + parse($t, $data); + + my $schema = $t->schema; + + my @tables = $schema->get_tables; + is( scalar @tables, 2, 'Parsed two tables' ); + + my $t1 = shift @tables; + is( $t1->name, 'person', "'Person' table" ); + + my $t2 = shift @tables; + is( $t2->name, 'pet', "'Pet' table" ); + + my @views = $schema->get_views; + is( scalar @views, 1, 'Parsed one views' ); + + my @triggers = $schema->get_triggers; + is( scalar @triggers, 1, 'Parsed one triggers' ); }