blob: bb286d26f827b80e42212a75db25db9907d1ae96 (
plain)
- use Test::More;
- use strict;
- if (!defined $ENV{LSMB_TEST_DB}){
- plan skip_all => 'Skipping all. Told not to test db.';
- }
- else {
- plan tests => 51;
- if (defined $ENV{LSMB_NEW_DB}){
- $ENV{PGDATABASE} = $ENV{LSMB_NEW_DB};
- }
- if (!defined $ENV{PGDATABASE}){
- die "We were told to run tests, but no database specified!";
- }
- }
- my @testscripts = qw(Account Business_type Company Draft Payment
- Session Voucher);
- chdir 'sql/modules/test/';
- for my $testscript (@testscripts){
- open (TEST, '-|', "psql -f $testscript.sql");
- my @testlines = grep /\|\s+(t|f)\s?$/, <TEST>;
- cmp_ok(scalar @testlines, '>', 0, "$testscript.sql returned test results");
- for my $test (@testlines){
- my @parts = split /\|/, $test;
- like($parts[1], qr/t\s?$/, $parts[0]);
- }
- }
|