chkpass: Add test suite
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 12 Aug 2017 01:04:04 +0000 (21:04 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 15 Sep 2017 02:23:00 +0000 (22:23 -0400)
Reviewed-by: David Steele <david@pgmasters.net>
contrib/chkpass/.gitignore [new file with mode: 0644]
contrib/chkpass/Makefile
contrib/chkpass/expected/chkpass.out [new file with mode: 0644]
contrib/chkpass/sql/chkpass.sql [new file with mode: 0644]

diff --git a/contrib/chkpass/.gitignore b/contrib/chkpass/.gitignore
new file mode 100644 (file)
index 0000000..5dcb3ff
--- /dev/null
@@ -0,0 +1,4 @@
+# Generated subdirectories
+/log/
+/results/
+/tmp_check/
index a2599ea239384ee6251579def2d38af1c65a28c0..dbecc3360be5f4f25f6ad965d1028c25dbcd57a8 100644 (file)
@@ -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 (file)
index 0000000..b53557b
--- /dev/null
@@ -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 (file)
index 0000000..595683e
--- /dev/null
@@ -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;