-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,54 @@ | |||
{ | |||
"name": "pgTAP", | |||
"abstract": "Unit testing for PostgreSQL", | |||
"description": "pgTAP is a suite of database functions that make it easy to write TAP-emitting unit tests in psql scripts or xUnit-style test functions.", | |||
"version": "0.26.0", | |||
"maintainer": [ | |||
"David E. Wheeler <david@kineticode.com>", | |||
"pgTAP List <pgtap-users@pgfoundry.org>" | |||
], | |||
"license": { | |||
"PostgreSQL": "http://www.postgresql.org/about/licence" | |||
}, | |||
"prereqs": { | |||
"runtime": { | |||
"requires": { | |||
"plpgsql": 0, | |||
"PostgreSQL": "8.0.0" | |||
}, | |||
"recommends": { | |||
"PostgreSQL": "8.4.0" | |||
} | |||
} | |||
}, | |||
"provides": { | |||
"pgtap": { | |||
"abstract": "Unit testing for PostgreSQL", | |||
"file": "pgtap.sql", | |||
"version": "0.26.0" | |||
} | |||
}, | |||
"resources": { | |||
"homepage": "http://pgtap.org/", | |||
"bugtracker": { | |||
"web": "https://github.com/theory/pgtap/issues" | |||
}, | |||
"repository": { | |||
"url": "https://github.com/theory/pgtap.git", | |||
"web": "https://github.com/theory/pgtap", | |||
"type": "git" | |||
} | |||
}, | |||
"generated_by": "David E. Wheeler", | |||
"meta-spec": { | |||
"version": "1.0.0", | |||
"url": "http://pgxn.org/meta/spec.txt" | |||
}, | |||
"tags": [ | |||
"testing", | |||
"unit testing", | |||
"tap", | |||
"tddd", | |||
"test driven database development" | |||
] | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
use strict; | |||
use warnings; | |||
use Test::More tests => 7; | |||
use File::Spec; | |||
|
|||
BEGIN { | |||
use_ok 'PGXN::Meta::Validator' or die; | |||
} | |||
|
|||
my $file = File::Spec->catfile(qw(t META.json)); | |||
|
|||
ok my $pmv = PGXN::Meta::Validator->new(JSON->new->decode(do { | |||
local $/; | |||
open my $fh, '<:raw', $file or die "Cannot open $file: $!\n"; | |||
<$fh>; | |||
})), 'Construct from data structure'; | |||
ok $pmv->is_valid, 'Structure should be valid'; | |||
|
|||
ok $pmv = PGXN::Meta::Validator->load_file($file), 'Load from file'; | |||
ok $pmv->is_valid, 'File should be valid'; | |||
|
|||
local $@; | |||
eval { | |||
PGXN::Meta::Validator->load_file('nonexistent'); | |||
}; | |||
like $@, qr{^load_file\(\) requires a valid, readable filename}, | |||
'Should catch exception for nonexistent file'; | |||
|
|||
eval { | |||
PGXN::Meta::Validator->load_file('Changes'); | |||
}; | |||
like $@, qr{^malformed JSON string}, | |||
'Should catch exception for invalid JSON'; |