pg_doctest 0.0.1

This Release
pg_doctest 0.0.1
Date
Status
Stable
Latest Stable
pg_doctest 0.0.2 —
Other Releases
Abstract
doctest for Postgres functions
Description
Write unit test inside your Postgres functions
Released By
daamien
License
PostgreSQL
Resources
Special Files
Tags

Extensions

anon 0.0.1
doctest for Postgres functions

Documentation

LICENSE
The PostgreSQL License
CHANGELOG
CHANGELOG

README

pg_doctest

doctest for Postgres functions !

Document and Test your SQL code all at once...

Example

Add your unit tests directly as comments inside the function body:

sql CREATE OR REPLACE FUNCTION foo.add ( a INT, b INT) RETURNS INT LANGUAGE SQL AS $$ -- >>> SELECT foo.add(1,1) -- 2 -- >>> SELECT foo.add(NULL,9) -- NULL -- >>> SELECT foo.add(4,2) -- 42 SELECT a+b; $$; Now run pg_doctest for the function inside the foo schema:

sql SELECT * FROM tests.run('foo'); function_name | passed | failed ---------------+--------+-------- foo.add | 2 | 1

Install

make make install

Once the extension is installed on the server, you can create it inside the database.

sql CREATE SCHEMA tests; CREATE EXTENSION pg_doctest WITH SCHEMA tests;