OSDN Git Service

Add regression test for the case where database encoding is not UTF8.
authorMasaoFujii <masao.fujii@gmail.com>
Wed, 26 Aug 2015 14:47:40 +0000 (23:47 +0900)
committerMasaoFujii <masao.fujii@gmail.com>
Wed, 26 Aug 2015 14:47:40 +0000 (23:47 +0900)
This patch adds the regression tests which check whether pgs2snippet1
and pgs2norm functions exit with an error when database encoding is
not UTF8.

expected/ludia_funcs.out
sql/ludia_funcs.sql

index fe4d738..4e5fd99 100644 (file)
@@ -759,3 +759,15 @@ SELECT pgs2norm(repeat(chr(8279),8));
  ′′′′′′′′′′′′′′′′′′′′′′′′′′′′′′′′
 (1 row)
 
+-- Clean up the objects that a prior regression test created
+SET client_min_messages TO 'warning';
+DROP DATABASE IF EXISTS regtest_ludia_funcs_eucjp;
+RESET client_min_messages;
+-- Test the case where database encoding is not UTF8
+CREATE DATABASE regtest_ludia_funcs_eucjp ENCODING 'EUC_JP' TEMPLATE template0;
+\c regtest_ludia_funcs_eucjp
+CREATE EXTENSION ludia_funcs;
+SELECT * FROM pgs2norm('abc');
+ERROR:  does not support database encoding "EUC_JP"
+SELECT pgs2snippet1(1,300,1,'@','@',0,'CDE','abcdefg');
+ERROR:  does not support database encoding "EUC_JP"
index f82a993..c78a08b 100644 (file)
@@ -157,3 +157,15 @@ SELECT pgs2norm('あイうエおabcdeかキくケこjklmn') FROM gen
 SELECT pgs2norm(repeat(chr(13078),10) || chr(65018) || 'あイうエおabcde' || chr(65018) || repeat(chr(13078),10) || 'かキくケこjklmn' || chr(65018) || repeat(chr(13078),10));
 SELECT pgs2norm(repeat(chr(13078),10) || chr(65018) || repeat(chr(13078),10) || chr(65018) || repeat(chr(13078),10));
 SELECT pgs2norm(repeat(chr(8279),8));
+
+-- Clean up the objects that a prior regression test created
+SET client_min_messages TO 'warning';
+DROP DATABASE IF EXISTS regtest_ludia_funcs_eucjp;
+RESET client_min_messages;
+
+-- Test the case where database encoding is not UTF8
+CREATE DATABASE regtest_ludia_funcs_eucjp ENCODING 'EUC_JP' TEMPLATE template0;
+\c regtest_ludia_funcs_eucjp
+CREATE EXTENSION ludia_funcs;
+SELECT * FROM pgs2norm('abc');
+SELECT pgs2snippet1(1,300,1,'@','@',0,'CDE','abcdefg');