58
58
59
59
my $h =$node -> interactive_psql(' postgres' , \$in , \$out ,$timer );
60
60
61
- ok ($out =~ / psql/ ," print startup banner" );
61
+ like ($out , qr / psql/ ," print startup banner" );
62
62
63
63
# Simple test case: type something and see if psql responds as expected
64
64
sub check_completion
@@ -75,57 +75,60 @@ sub check_completion
75
75
# send the data to be sent
76
76
$in .=$send ;
77
77
# wait ...
78
- pump$h until ($out =~m / $pattern / ||$timer -> is_expired);
79
- my $okay = ($out =~m / $pattern / && !$timer -> is_expired);
78
+ pump$h until ($out =~$pattern ||$timer -> is_expired);
79
+ my $okay = ($out =~$pattern && !$timer -> is_expired);
80
80
ok($okay ,$annotation );
81
81
# for debugging, log actual output if it didn't match
82
82
local $Data::Dumper::Terse = 1;
83
83
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 ;
85
86
return ;
86
87
}
87
88
88
89
# Clear query buffer to start over
89
90
# (won't work if we are inside a string literal!)
90
91
sub clear_query
91
92
{
92
- check_completion(" \\ r\n " ," postgres=#" ," \\ r works" );
93
+ check_completion(" \\ r\n " ,qr / postgres=#/ ," \\ r works" );
93
94
return ;
94
95
}
95
96
96
97
# 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" );
98
99
99
100
clear_query();
100
101
101
102
# 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" );
103
104
104
105
# 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" );
106
107
107
108
clear_query();
108
109
109
110
# check table name completion with multiple alternatives
110
111
# note: readline might print a bell before the completion
111
112
check_completion(
112
113
" select * from my\t " ,
113
- " select\\ * from my\a ?tab" ,
114
+ qr / select\* from my\a ?tab/ ,
114
115
" complete my<tab> to mytab when there are multiple choices" );
115
116
116
117
# 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/ ,
118
121
" offer multiple table choices" );
119
122
120
- check_completion(" 2\t " ," 246" ,
123
+ check_completion(" 2\t " ,qr / 246/ ,
121
124
" finish completion of one of multiple table choices" );
122
125
123
126
clear_query();
124
127
125
128
# check case-sensitive keyword replacement
126
129
# note: various versions of readline/libedit handle backspacing
127
130
# 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" );
129
132
130
133
clear_query();
131
134