Skip to content

Commit 112fdee

Browse files
committed
Add missing BEING/END to PL/pgSQL function.
And add a comment about the hypothetical `users` table. Resolves #163.
1 parent ba2236c commit 112fdee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/pgtap.mmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,19 @@ What a sweet unit!
305305

306306
If you're used to xUnit testing frameworks, you can collect all of your tests
307307
into database functions and run them all at once with `runtests()`. This is
308-
similar to how [PGUnit](http://en.dklab.ru/lib/dklab_pgunit/)s. The
308+
similar to how [PGUnit](http://en.dklab.ru/lib/dklab_pgunit/) works. The
309309
`runtests()` function does all the work of finding and running your test
310310
functions in individual transactions. It even supports setup and teardown
311311
functions. To use it, write your unit test functions so that they return a set
312312
of text results, and then use the pgTAP assertion functions to return TAP
313-
values, like so:
313+
values. Here's an example, testing a hypothetical `users` table:
314314

315315
CREATE OR REPLACE FUNCTION setup_insert(
316316
) RETURNS SETOF TEXT AS $$
317+
BEGIN
317318
RETURN NEXT is( MAX(nick), NULL, 'Should have no users') FROM users;
318319
INSERT INTO users (nick) VALUES ('theory');
320+
END;
319321
$$ LANGUAGE plpgsql;
320322

321323
CREATE OR REPLACE FUNCTION test_user(

0 commit comments

Comments
 (0)