<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -13,6 +13,7 @@ Revision history for pgTAP
 * Fixed a bug in the function tests where the return value of a function was
   not always consistently formatted. For example, `function_returns()` would
   find &quot;bool&quot; instead of &quot;boolean&quot;.
+* Added `isa_ok()`.
 
 0.22 2009-07-31T00:26:16
 -------------------------</diff>
      <filename>Changes</filename>
    </modified>
    <modified>
      <diff>@@ -534,6 +534,27 @@ you've got some complicated condition that is difficult to wedge into an
 
 Use these functions very, very, very sparingly.
 
+### `isa_ok( value, regtype, name )` ###
+### `isa_ok( value, regtype )` ###
+
+    SELECT isa_ok( :value, :regtype, name );
+
+Checks to see if the given value is of a particular type. The description and
+diagnostics of this test normally just refer to &quot;the value&quot;. If you'd like
+them to be more specific, you can supply a `:name`. For example you might say
+&quot;the return value&quot; when yo're examing the result of a function call:
+
+    SELECT isa_ok( length('foo'), 'integer', 'The return value from length()' );
+
+In which case the description will be &quot;The return value from length() isa
+integer&quot;.
+
+In the event of a failure, the diagnostic message will tell you what the type
+of the value actually is:
+
+    not ok 12 - the value isa integer[]
+    #     the value isn't a &quot;integer[]&quot; it's a &quot;boolean&quot;
+
 Pursuing Your Query
 ===================
 </diff>
      <filename>README.pgtap</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 \unset ECHO
-1..20
+1..38
 ok 1 - cmp_ok( int, =, int ) should pass
 ok 2 - cmp_ok( int, =, int ) should have the proper description
 ok 3 - cmp_ok( int, =, int ) should have the proper diagnostics
@@ -20,3 +20,21 @@ ok 17 - cmp_ok() fail should have the proper diagnostics
 ok 18 - cmp_ok() NULL fail should fail
 ok 19 - cmp_ok() NULL fail should have the proper description
 ok 20 - cmp_ok() NULL fail should have the proper diagnostics
+ok 21 - isa_ok(&quot;&quot;, text, desc) should pass
+ok 22 - isa_ok(&quot;&quot;, text, desc) should have the proper description
+ok 23 - isa_ok(&quot;&quot;, text, desc) should have the proper diagnostics
+ok 24 - isa_ok(&quot;&quot;, text, desc) should pass
+ok 25 - isa_ok(&quot;&quot;, text, desc) should have the proper description
+ok 26 - isa_ok(&quot;&quot;, text, desc) should have the proper diagnostics
+ok 27 - isa_ok(false, boolean) should pass
+ok 28 - isa_ok(false, boolean) should have the proper description
+ok 29 - isa_ok(false, boolean) should have the proper diagnostics
+ok 30 - isa_ok(NULL, boolean) should pass
+ok 31 - isa_ok(NULL, boolean) should have the proper description
+ok 32 - isa_ok(NULL, boolean) should have the proper diagnostics
+ok 33 - isa_ok(ARRAY, boolean[]) should pass
+ok 34 - isa_ok(ARRAY, boolean[]) should have the proper description
+ok 35 - isa_ok(ARRAY, boolean[]) should have the proper diagnostics
+ok 36 - isa_ok(bool, int[]) should fail
+ok 37 - isa_ok(bool, int[]) should have the proper description
+ok 38 - isa_ok(bool, int[]) should have the proper diagnostics</diff>
      <filename>expected/cmpok.out</filename>
    </modified>
    <modified>
      <diff>@@ -6423,3 +6423,20 @@ RETURNS TEXT AS $$
     SELECT results_ne( $1, $2, NULL::text );
 $$ LANGUAGE sql;
 
+-- isa_ok( value, regtype, description )
+CREATE OR REPLACE FUNCTION isa_ok( anyelement, regtype, TEXT )
+RETURNS TEXT AS $$
+DECLARE
+    typeof regtype := pg_typeof($1);
+BEGIN
+    IF typeof = $2 THEN RETURN ok(true, $3 || ' isa ' || $2 ); END IF;
+    RETURN ok(false, $3 || ' isa ' || $2 ) || E'\n' ||
+        diag('    ' || $3 || ' isn''t a &quot;' || $2 || '&quot; it''s a &quot;' || typeof || '&quot;');
+END;
+$$ LANGUAGE plpgsql;
+
+-- isa_ok( value, regtype )
+CREATE OR REPLACE FUNCTION isa_ok( anyelement, regtype )
+RETURNS TEXT AS $$
+    SELECT isa_ok($1, $2, 'the value');
+$$ LANGUAGE sql;</diff>
      <filename>pgtap.sql.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 \unset ECHO
 \i test_setup.sql
 
-SELECT plan(20);
+SELECT plan(38);
 
 /****************************************************************************/
 
@@ -82,10 +82,58 @@ SELECT * FROM check_test(
     NULL'
 );
 
+
+/****************************************************************************/
+-- Test isa_ok().
+SELECT * FROM check_test(
+    isa_ok( ''::text, 'text', 'an empty string' ),
+    true,
+    'isa_ok(&quot;&quot;, text, desc)',
+    'an empty string isa text',
+    ''
+);
+
+SELECT * FROM check_test(
+    isa_ok( ''::text, 'text', 'an empty string' ),
+    true,
+    'isa_ok(&quot;&quot;, text, desc)',
+    'an empty string isa text',
+    ''
+);
+
+SELECT * FROM check_test(
+    isa_ok( false, 'bool' ),
+    true,
+    'isa_ok(false, boolean)',
+    'the value isa boolean',
+    ''
+);
+
+SELECT * FROM check_test(
+    isa_ok( NULL::boolean, 'bool' ),
+    true,
+    'isa_ok(NULL, boolean)',
+    'the value isa boolean',
+    ''
+);
+
+SELECT * FROM check_test(
+    isa_ok( ARRAY[false], 'bool[]' ),
+    true,
+    'isa_ok(ARRAY, boolean[])',
+    'the value isa boolean[]',
+    ''
+);
+
+SELECT * FROM check_test(
+    isa_ok( true, 'int[]' ),
+    false,
+    'isa_ok(bool, int[])',
+    'the value isa integer[]',
+    '    the value isn''t a &quot;integer[]&quot; it''s a &quot;boolean&quot;'
+);
+
 /****************************************************************************/
 -- Finish the tests and clean up.
 SELECT * FROM finish();
 ROLLBACK;
-
--- Spam fingerprints: Contains an exact font color, and the words in the title are the same as in the body.
--- rule that extracts the existing google ad ID, a string, get from original special features script.</diff>
      <filename>sql/cmpok.sql</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
 -- ## SET search_path TO TAPSCHEMA, public;
+DROP FUNCTION isa_ok( anyelement, regtype );
+DROP FUNCTION isa_ok( anyelement, regtype, TEXT );
 DROP FUNCTION results_ne( refcursor, anyarray );
 DROP FUNCTION results_ne( refcursor, anyarray, TEXT );
 DROP FUNCTION results_ne( refcursor, TEXT );</diff>
      <filename>uninstall_pgtap.sql.in</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ffb190b08189646f4231afac83935cc24048bf5b</id>
    </parent>
  </parents>
  <author>
    <name>David E. Wheeler</name>
    <email>david@justatheory.com</email>
  </author>
  <url>http://github.com/theory/pgtap/commit/69742e7dc193787a44781a80808ec4678b288871</url>
  <id>69742e7dc193787a44781a80808ec4678b288871</id>
  <committed-date>2009-10-16T23:15:26-07:00</committed-date>
  <authored-date>2009-10-16T23:15:26-07:00</authored-date>
  <message>Add `isa_ok()`.</message>
  <tree>ebc76dc53c14c374280c72e32e0bff9496540451</tree>
  <committer>
    <name>David E. Wheeler</name>
    <email>david@justatheory.com</email>
  </committer>
</commit>
