Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9028cce

Browse files
committed
psql: Additional tests
Add a few TAP tests for things that happen while a user query is beingsent:- \timing- client encoding handling- notificationsDiscussion:https://www.postgresql.org/message-id/3199e176-424e-1bef-f180-c1548466c2da@enterprisedb.com
1 parenta33e17f commit9028cce

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

‎src/bin/psql/t/001_basic.pl

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ sub psql_fails_like
6060
}
6161

6262
my$node = PostgreSQL::Test::Cluster->new('main');
63-
$node->init;
63+
$node->init(extra=> ['--locale=C','--encoding=UTF8' ]);
6464
$node->append_conf(
6565
'postgresql.conf',q{
6666
wal_level = 'logical'
@@ -80,4 +80,39 @@ sub psql_fails_like
8080
qr/unexpected PQresultStatus: 8$/,
8181
'handling of unexpected PQresultStatus');
8282

83+
# test \timing
84+
psql_like(
85+
$node,
86+
'\timing on
87+
SELECT 1',
88+
qr/^1$
89+
^Time:\d+.\d\d\d ms/m,
90+
'\timing');
91+
92+
# test that ENCODING variable is set and that it is updated when
93+
# client encoding is changed
94+
psql_like(
95+
$node,
96+
'\echo :ENCODING
97+
set client_encoding = LATIN1;
98+
\echo :ENCODING',
99+
qr/^UTF8$
100+
^LATIN1$/m,
101+
'ENCODING variable is set and updated');
102+
103+
# test LISTEN/NOTIFY
104+
psql_like(
105+
$node,
106+
'LISTEN foo;
107+
NOTIFY foo;',
108+
qr/^Asynchronous notification "foo" received from server process with PID\d+\.$/,
109+
'notification');
110+
111+
psql_like(
112+
$node,
113+
"LISTEN foo;
114+
NOTIFY foo, 'bar';",
115+
qr/^Asynchronous notification "foo" with payload "bar" received from server process with PID\d+\.$/,
116+
'notification with payload');
117+
83118
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp