aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-08-11 21:04:04 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-09-14 22:23:00 -0400
commit8423bf4f25ecd7afdd1d89adfbf29ea28992678f (patch)
tree1b2d2f36cab8f6fd4f1cb96f633d878ed19f39bd
parent4cb89d830626d009ed6a4482bed3a141c5039a7c (diff)
downloadpostgresql-8423bf4f25ecd7afdd1d89adfbf29ea28992678f.tar.gz
postgresql-8423bf4f25ecd7afdd1d89adfbf29ea28992678f.zip
chkpass: Add test suite
Reviewed-by: David Steele <david@pgmasters.net>
-rw-r--r--contrib/chkpass/.gitignore4
-rw-r--r--contrib/chkpass/Makefile2
-rw-r--r--contrib/chkpass/expected/chkpass.out18
-rw-r--r--contrib/chkpass/sql/chkpass.sql7
4 files changed, 31 insertions, 0 deletions
diff --git a/contrib/chkpass/.gitignore b/contrib/chkpass/.gitignore
new file mode 100644
index 00000000000..5dcb3ff9723
--- /dev/null
+++ b/contrib/chkpass/.gitignore
@@ -0,0 +1,4 @@
+# Generated subdirectories
+/log/
+/results/
+/tmp_check/
diff --git a/contrib/chkpass/Makefile b/contrib/chkpass/Makefile
index a2599ea2393..dbecc3360be 100644
--- a/contrib/chkpass/Makefile
+++ b/contrib/chkpass/Makefile
@@ -9,6 +9,8 @@ PGFILEDESC = "chkpass - encrypted password data type"
SHLIB_LINK = $(filter -lcrypt, $(LIBS))
+REGRESS = chkpass
+
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/chkpass/expected/chkpass.out b/contrib/chkpass/expected/chkpass.out
new file mode 100644
index 00000000000..b53557bf2af
--- /dev/null
+++ b/contrib/chkpass/expected/chkpass.out
@@ -0,0 +1,18 @@
+CREATE EXTENSION chkpass;
+WARNING: type input function chkpass_in should not be volatile
+CREATE TABLE test (i int, p chkpass);
+INSERT INTO test VALUES (1, 'hello'), (2, 'goodbye');
+SELECT i, p = 'hello' AS "hello?" FROM test;
+ i | hello?
+---+--------
+ 1 | t
+ 2 | f
+(2 rows)
+
+SELECT i, p <> 'hello' AS "!hello?" FROM test;
+ i | !hello?
+---+---------
+ 1 | f
+ 2 | t
+(2 rows)
+
diff --git a/contrib/chkpass/sql/chkpass.sql b/contrib/chkpass/sql/chkpass.sql
new file mode 100644
index 00000000000..595683e249a
--- /dev/null
+++ b/contrib/chkpass/sql/chkpass.sql
@@ -0,0 +1,7 @@
+CREATE EXTENSION chkpass;
+
+CREATE TABLE test (i int, p chkpass);
+INSERT INTO test VALUES (1, 'hello'), (2, 'goodbye');
+
+SELECT i, p = 'hello' AS "hello?" FROM test;
+SELECT i, p <> 'hello' AS "!hello?" FROM test;