From e8a4e031eb1604d8a3c61baf7340c986833ec986 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 29 Aug 2007 22:25:59 +0000 Subject: Fix lots of problems with the schema and rework it a little bit to be compatible with SQLite. Mostly this involves creating indexes separately rather than part of the create table statement. --- perl/t/schema.t | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 perl/t/schema.t (limited to 'perl/t/schema.t') diff --git a/perl/t/schema.t b/perl/t/schema.t new file mode 100755 index 0000000..4c5105d --- /dev/null +++ b/perl/t/schema.t @@ -0,0 +1,28 @@ +#!/usr/bin/perl -w +# $Id$ +# +# t/schema.t -- Tests for the wallet schema class. + +use Test::More tests => 5; + +use DBD::SQLite; +use DBI; +use Wallet::Schema; + +my $schema = Wallet::Schema->new; +ok (defined $schema, 'Wallet::Schema creation'); +ok ($schema->isa ('Wallet::Schema'), ' and class verification'); +my @sql = $schema->sql; +ok (@sql > 0, 'sql() returns something'); +is (scalar (@sql), 22, ' and returns the right number of statements'); + +# Create a SQLite database to use for create. +my $dbh = DBI->connect ("DBI:SQLite:wallet-db"); +if (not defined $dbh) { + die "cannot create database wallet-db: $DBI::errstr\n"; +} +$dbh->{RaiseError} = 1; +$dbh->{PrintError} = 0; +eval { $schema->create ($dbh) }; +is ($@, '', "create() doesn't die"); +unlink 'wallet-db'; -- cgit v1.2.3