Permalink
Browse files

Add tests.

  • Loading branch information...
1 parent b16ce30 commit dc5ce172c6f929913bf14814ae3d5fb38798bd48 @theory committed Sep 2, 2011
Showing with 45 additions and 0 deletions.
  1. +3 −0 Makefile
  2. +26 −0 test/expected/base.out
  3. +16 −0 test/sql/base.sql
View
@@ -5,6 +5,9 @@ EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
DOCS = $(wildcard doc/*.mmd)
+TESTS = $(wildcard test/sql/*.sql)
+REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
+REGRESS_OPTS = --inputdir=test
PG_CONFIG = pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
View
@@ -0,0 +1,26 @@
+\set ECHO 0
+ colnames
+------------
+ {f1,f2,f3}
+(1 row)
+
+ colnames
+-----------------------------------------------------------------------
+ {collname,collnamespace,collowner,collencoding,collcollate,collctype}
+(1 row)
+
+ colnames
+-----------------------------------------------------------------------
+ {collname,collnamespace,collowner,collencoding,collcollate,collctype}
+(1 row)
+
+ colnames
+-----------
+ {id,name}
+(1 row)
+
+ colnames
+----------------------
+ {"The Id","My Name"}
+(1 row)
+
View
@@ -0,0 +1,16 @@
+\set ECHO 0
+BEGIN;
+\set QUIET 1
+\i sql/colnames.sql
+
+SELECT colnames( ROW(1, 3, 'foo') );
+SELECT colnames( ROW(c.*)::pg_collation ) FROM pg_collation c LIMIT 1;
+SELECT colnames( NULL::pg_collation );
+
+CREATE TYPE foo AS (id int, name text);
+SELECT colnames( row(1, 'foo')::foo );
+
+CREATE TYPE bar AS ("The Id" int, "My Name" text);
+SELECT colnames( row(1, 'bar')::bar );
+
+ROLLBACK;

0 comments on commit dc5ce17

Please sign in to comment.