@@ -142,12 +142,30 @@ testHost({
142
142
// 2nd call, do nothing.
143
143
"let g:__test_denops_server_start_result_2nd = denops#server#start()" ,
144
144
"let g:__test_denops_server_status_2nd = denops#server#status()" ,
145
- ] , "" ) ;
146
- await host . call ( "execute" , [
147
145
// 3rd call with asynchronously, do nothing.
148
- "let g:__test_denops_server_start_result_3rd = denops#server#start()" ,
149
- "let g:__test_denops_server_status_3rd = denops#server#status()" ,
146
+ "function! TestDenopsServerStartAlreadyStarting(...) abort" ,
147
+ " try" ,
148
+ " let g:__test_denops_server_start_result_3rd = denops#server#start()" ,
149
+ " let g:__test_denops_server_status_3rd = denops#server#status()" ,
150
+ " catch" ,
151
+ " let g:__test_denops_server_error_3rd = v:exception" ,
152
+ " finally" ,
153
+ " let g:__test_denops_server_called_3rd = 1" ,
154
+ " endtry" ,
155
+ "endfunction" ,
156
+ "call timer_start(0, 'TestDenopsServerStartAlreadyStarting')" ,
150
157
] , "" ) ;
158
+ // Wait for the 3rd call to finish.
159
+ await wait (
160
+ ( ) => host . call ( "exists" , "g:__test_denops_server_called_3rd" ) ,
161
+ { message : "3rd call to start() is not finished" } ,
162
+ ) ;
163
+
164
+ const error = await host . call (
165
+ "eval" ,
166
+ "get(g:, '__test_denops_server_error_3rd', '')" ,
167
+ ) ;
168
+ assertEquals ( error , "" , "should not throws an error" ) ;
151
169
152
170
await t . step ( "returns falsy" , async ( ) => {
153
171
assertFalse (
@@ -158,13 +176,16 @@ testHost({
158
176
) ;
159
177
} ) ;
160
178
161
- await t . step ( "does not change status from 'running'" , async ( ) => {
162
- const actual = await host . call (
163
- "eval" ,
164
- "[g:__test_denops_server_status_2nd, g:__test_denops_server_status_3rd]" ,
165
- ) ;
166
- assertEquals ( actual , [ "starting" , "starting" ] ) ;
167
- } ) ;
179
+ await t . step (
180
+ "does not change status from 'starting' (flaky)" ,
181
+ async ( ) => {
182
+ const actual = await host . call (
183
+ "eval" ,
184
+ "[g:__test_denops_server_status_2nd, g:__test_denops_server_status_3rd]" ,
185
+ ) ;
186
+ assertEquals ( actual , [ "starting" , "starting" ] ) ;
187
+ } ,
188
+ ) ;
168
189
} ) ;
169
190
170
191
await t . step ( "if already connected to shared-server" , async ( t ) => {
0 commit comments