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

Commit8c081a2

Browse files
committed
Minor style improvements for tab-completion test.
Use qr// syntax for regex values.Include the regex that failed to match in diagnostic reports.Dagfinn Ilmari MannsåkerDiscussion:https://postgr.es/m/87k16610xk.fsf@wibble.ilmari.org
1 parent955f121 commit8c081a2

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

‎src/bin/psql/t/010_tab_completion.pl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
my$h =$node->interactive_psql('postgres', \$in, \$out,$timer);
6060

61-
ok($out =~/psql/,"print startup banner");
61+
like($out,qr/psql/,"print startup banner");
6262

6363
# Simple test case: type something and see if psql responds as expected
6464
subcheck_completion
@@ -75,57 +75,60 @@ sub check_completion
7575
# send the data to be sent
7676
$in .=$send;
7777
# wait ...
78-
pump$huntil ($out =~m/$pattern/ ||$timer->is_expired);
79-
my$okay = ($out =~m/$pattern/ && !$timer->is_expired);
78+
pump$huntil ($out =~$pattern ||$timer->is_expired);
79+
my$okay = ($out =~$pattern && !$timer->is_expired);
8080
ok($okay,$annotation);
8181
# for debugging, log actual output if it didn't match
8282
local$Data::Dumper::Terse = 1;
8383
local$Data::Dumper::Useqq = 1;
84-
diag'Actual output was' . Dumper($out) ."\n"if !$okay;
84+
diag'Actual output was' . Dumper($out) ."Did not match\"$pattern\"\n"
85+
if !$okay;
8586
return;
8687
}
8788

8889
# Clear query buffer to start over
8990
# (won't work if we are inside a string literal!)
9091
subclear_query
9192
{
92-
check_completion("\\r\n","postgres=#","\\r works");
93+
check_completion("\\r\n",qr/postgres=#/,"\\r works");
9394
return;
9495
}
9596

9697
# check basic command completion: SEL<tab> produces SELECT<space>
97-
check_completion("SEL\t","SELECT","complete SEL<tab> to SELECT");
98+
check_completion("SEL\t",qr/SELECT/,"complete SEL<tab> to SELECT");
9899

99100
clear_query();
100101

101102
# check case variation is honored
102-
check_completion("sel\t","select","complete sel<tab> to select");
103+
check_completion("sel\t",qr/select/,"complete sel<tab> to select");
103104

104105
# check basic table name completion
105-
check_completion("* from t\t","\\* from tab1","complete t<tab> to tab1");
106+
check_completion("* from t\t",qr/\* from tab1/,"complete t<tab> to tab1");
106107

107108
clear_query();
108109

109110
# check table name completion with multiple alternatives
110111
# note: readline might print a bell before the completion
111112
check_completion(
112113
"select * from my\t",
113-
"select\\* from my\a?tab",
114+
qr/select\* from my\a?tab/,
114115
"complete my<tab> to mytab when there are multiple choices");
115116

116117
# some versions of readline/libedit require two tabs here, some only need one
117-
check_completion("\t\t","mytab123 +mytab246",
118+
check_completion(
119+
"\t\t",
120+
qr/mytab123 +mytab246/,
118121
"offer multiple table choices");
119122

120-
check_completion("2\t","246",
123+
check_completion("2\t",qr/246/,
121124
"finish completion of one of multiple table choices");
122125

123126
clear_query();
124127

125128
# check case-sensitive keyword replacement
126129
# note: various versions of readline/libedit handle backspacing
127130
# differently, so just check that the replacement comes out correctly
128-
check_completion("\\DRD\t","drds","complete\\DRD<tab> to\\drds");
131+
check_completion("\\DRD\t",qr/drds/,"complete\\DRD<tab> to\\drds");
129132

130133
clear_query();
131134

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp