Changeset 21 for trunk/epic
- Timestamp:
- 08/31/08 18:51:36 (3 years ago)
- Files:
-
- 1 modified
-
trunk/epic/epic.sql (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/epic/epic.sql
r20 r21 615 615 616 616 617 CREATE OR REPLACE FUNCTION test.assert_rows( source text, expectedtext) RETURNS VOID AS $$617 CREATE OR REPLACE FUNCTION test.assert_rows(call_1 text, call_2 text) RETURNS VOID AS $$ 618 618 -- Asserts that two sets of rows have equal values. 619 619 -- 620 620 -- Both arguments should be SELECT statements yielding a single row or a set of rows. 621 621 -- Either may also be any table, view, or procedure call that returns records. 622 -- It is also common for the 'expected'arg to be sans a FROM clause, and simply SELECT values.622 -- It is also common for the second arg to be sans a FROM clause, and simply SELECT values. 623 623 -- Neither source nor expected need to be sorted. Either may include a trailing semicolon. 624 624 -- … … 632 632 e text; 633 633 BEGIN 634 s := test.statement( source);635 e := test.statement( expected);634 s := test.statement(call_1); 635 e := test.statement(call_2); 636 636 637 637 FOR rec in EXECUTE s || ' EXCEPT ' || e 638 638 LOOP 639 RAISE EXCEPTION 'Record: % from: % not found in: %', rec, source, expected;639 RAISE EXCEPTION 'Record: % from: % not found in: %', rec, call_1, call_2; 640 640 END LOOP; 641 641 642 642 FOR rec in EXECUTE e || ' EXCEPT ' || s 643 643 LOOP 644 RAISE EXCEPTION 'Record: % from: % not found in: %', rec, expected, source;644 RAISE EXCEPTION 'Record: % from: % not found in: %', rec, call_2, call_1; 645 645 END LOOP; 646 646 END;
