blob: 08052a5cf20fbd217ed1cbe63ceedd9ba410c478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
{
fetchFromGitHub,
lib,
perl,
perlPackages,
postgresql,
postgresqlBuildExtension,
postgresqlTestHook,
stdenv,
which,
}:
postgresqlBuildExtension (finalAttrs: {
pname = "pgtap";
version = "1.3.4";
src = fetchFromGitHub {
owner = "theory";
repo = "pgtap";
tag = "v${finalAttrs.version}";
hash = "sha256-SKac6JJmH/z7G1GmQYATMNfywsDIHjNdskzn2MT3kBg=";
};
nativeBuildInputs = [
perl
perlPackages.TAPParserSourceHandlerpgTAP
which
];
passthru.tests.extension = stdenv.mkDerivation {
name = "pgtap-test";
dontUnpack = true;
doCheck = true;
nativeCheckInputs = [
postgresqlTestHook
(postgresql.withPackages (_: [ finalAttrs.finalPackage ]))
];
sql = ''
CREATE EXTENSION pgtap;
BEGIN;
SELECT plan(1);
SELECT pass('Test passed');
SELECT * FROM finish();
ROLLBACK;
'';
checkPhase = ''
runHook preCheck
sqlPath=$TMPDIR/test.sql
printf "%s" "$sql" > $sqlPath
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
runHook postCheck
'';
installPhase = "touch $out";
__structuredAttrs = true;
};
meta = {
description = "Unit testing framework for PostgreSQL";
longDescription = ''
pgTAP is a unit testing framework for PostgreSQL written in PL/pgSQL and PL/SQL.
It includes a comprehensive collection of TAP-emitting assertion functions,
as well as the ability to integrate with other TAP-emitting test frameworks.
It can also be used in the xUnit testing style.
'';
maintainers = [ ];
homepage = "https://pgtap.org";
inherit (postgresql.meta) platforms;
license = lib.licenses.mit;
};
})
|