Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

I kant spel.

  • Loading branch information...
commit 446980b9b80291e4ad77d99710a8864656c274f6 1 parent a92a806
@theory authored
View
1  Changes
@@ -4,6 +4,7 @@ Revision history for pgTAP
0.93.0
---------------------------
* Added `schema_owner_is()`. Not sure how I overlooked adding it in v0.92.0.
+* Fixed misselling of "constraint" in constraint test diagnostic output.
0.92.0 2013-01-16T00:41:07Z
---------------------------
View
4 compat/install-8.1.patch
@@ -17,7 +17,7 @@
+ keys = keys || rec.a::text;
END LOOP;
IF array_upper(keys, 0) = 1 THEN
- have := 'No ' || $6 || ' constriants';
+ have := 'No ' || $6 || ' constraints';
@@ -2146,13 +2146,13 @@
CREATE OR REPLACE FUNCTION _constraint ( NAME, CHAR, NAME[], TEXT, TEXT )
RETURNS TEXT AS $$
@@ -35,7 +35,7 @@
+ keys = keys || rec.a::text;
END LOOP;
IF array_upper(keys, 0) = 1 THEN
- have := 'No ' || $5 || ' constriants';
+ have := 'No ' || $5 || ' constraints';
@@ -5735,7 +5735,7 @@
CREATE OR REPLACE FUNCTION _runem( text[], boolean )
RETURNS SETOF TEXT AS $$
View
48 sql/pgtap--0.92.0--0.93.0.sql
@@ -31,3 +31,51 @@ RETURNS TEXT AS $$
'Schema ' || quote_ident($1) || ' should be owned by ' || quote_ident($2)
);
$$ LANGUAGE sql;
+
+CREATE OR REPLACE FUNCTION _constraint ( NAME, NAME, CHAR, NAME[], TEXT, TEXT )
+RETURNS TEXT AS $$
+DECLARE
+ akey NAME[];
+ keys TEXT[] := '{}';
+ have TEXT;
+BEGIN
+ FOR akey IN SELECT * FROM _keys($1, $2, $3) LOOP
+ IF akey = $4 THEN RETURN pass($5); END IF;
+ keys = keys || akey::text;
+ END LOOP;
+ IF array_upper(keys, 0) = 1 THEN
+ have := 'No ' || $6 || ' constraints';
+ ELSE
+ have := array_to_string(keys, E'\n ');
+ END IF;
+
+ RETURN fail($5) || E'\n' || diag(
+ ' have: ' || have
+ || E'\n want: ' || CASE WHEN $4 IS NULL THEN 'NULL' ELSE $4::text END
+ );
+END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION _constraint ( NAME, CHAR, NAME[], TEXT, TEXT )
+RETURNS TEXT AS $$
+DECLARE
+ akey NAME[];
+ keys TEXT[] := '{}';
+ have TEXT;
+BEGIN
+ FOR akey IN SELECT * FROM _keys($1, $2) LOOP
+ IF akey = $3 THEN RETURN pass($4); END IF;
+ keys = keys || akey::text;
+ END LOOP;
+ IF array_upper(keys, 0) = 1 THEN
+ have := 'No ' || $5 || ' constraints';
+ ELSE
+ have := array_to_string(keys, E'\n ');
+ END IF;
+
+ RETURN fail($4) || E'\n' || diag(
+ ' have: ' || have
+ || E'\n want: ' || CASE WHEN $3 IS NULL THEN 'NULL' ELSE $3::text END
+ );
+END;
+$$ LANGUAGE plpgsql;
View
4 sql/pgtap.sql.in
@@ -2088,7 +2088,7 @@ BEGIN
keys = keys || akey::text;
END LOOP;
IF array_upper(keys, 0) = 1 THEN
- have := 'No ' || $6 || ' constriants';
+ have := 'No ' || $6 || ' constraints';
ELSE
have := array_to_string(keys, E'\n ');
END IF;
@@ -2112,7 +2112,7 @@ BEGIN
keys = keys || akey::text;
END LOOP;
IF array_upper(keys, 0) = 1 THEN
- have := 'No ' || $5 || ' constriants';
+ have := 'No ' || $5 || ' constraints';
ELSE
have := array_to_string(keys, E'\n ');
END IF;
Please sign in to comment.
Something went wrong with that request. Please try again.