File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -305,17 +305,19 @@ What a sweet unit!
305305
306306If you're used to xUnit testing frameworks, you can collect all of your tests
307307into 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
310310functions in individual transactions. It even supports setup and teardown
311311functions. To use it, write your unit test functions so that they return a set
312312of 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(
You can’t perform that action at this time.
0 commit comments