|
@@ -1,5 +1,10 @@
|
|
|
function! SetUp()
|
|
|
+ let g:ycm_use_clangd = 1
|
|
|
+ let g:ycm_confirm_extra_conf = 0
|
|
|
+ let g:ycm_auto_trigger = 1
|
|
|
+ let g:ycm_keep_logfiles = 1
|
|
|
let g:ycm_log_level = 'DEBUG'
|
|
|
+ let g:ycm_always_populate_location_list = 1
|
|
|
call youcompleteme#test#setup#SetUp()
|
|
|
endfunction
|
|
|
|
|
@@ -12,20 +17,29 @@ function! Test_Changing_Filetype_Refreshes_Diagnostics()
|
|
|
\ '/test/testdata/diagnostics/foo.xml',
|
|
|
\ { 'native_ft': 0 } )
|
|
|
|
|
|
- function! Check( id ) closure
|
|
|
- assert_true( pyxeval( 'ycm_state._buffers[ 1 ]._async_diags' ) )
|
|
|
- assert_equal( 'xml', '&ft' )
|
|
|
- assert_equal( [], sign_getplaced() )
|
|
|
- setf typescript
|
|
|
- assert_equal( 'typescript', '&ft' )
|
|
|
- assert_false( pyxeval( 'ycm_state._buffers[ 1 ]._async_diags' ) )
|
|
|
- " Diagnostics are async, so wait for the assert to return 0 for a while.
|
|
|
- call WaitForAssert( {-> assert_equal( 1, len( sign_getplaced() ) ) }, 10000 )
|
|
|
- assert_equal( 1, len( sign_getplaced()[ 0 ][ 'signs' ] ) )
|
|
|
- assert_equal( 1, sign_getplaced()[ 0 ][ 'bufnr' ] )
|
|
|
- assert_equal( 'YcmError', sign_getplaced()[ 0 ][ 'signs' ][ 0 ][ 'name' ] )
|
|
|
- endfunction
|
|
|
+ call assert_equal( 'xml', &ft )
|
|
|
+ call assert_true( pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) )
|
|
|
+ call assert_equal( [], sign_getplaced() )
|
|
|
+ setf typescript
|
|
|
+ call assert_equal( 'typescript', &ft )
|
|
|
+ call assert_false( pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) )
|
|
|
+ " Diagnostics are async, so wait for the assert to return 0 for a while.
|
|
|
+ call WaitForAssert( {-> assert_equal( 1, len( sign_getplaced() ) ) } )
|
|
|
+ call assert_equal( 1, len( sign_getplaced()[ 0 ][ 'signs' ] ) )
|
|
|
+ call assert_equal( 'YcmError', sign_getplaced()[ 0 ][ 'signs' ][ 0 ][ 'name' ] )
|
|
|
+ call assert_false( empty( getloclist( 0 ) ) )
|
|
|
+ %bwipeout!
|
|
|
+endfunction
|
|
|
|
|
|
- call timer_start( 500, funcref( 'Check' ) )
|
|
|
+function! Test_MessagePoll_After_LocationList()
|
|
|
+ call youcompleteme#test#setup#OpenFile( '/test/testdata/diagnostics/foo.cpp', {} )
|
|
|
+
|
|
|
+ setf cpp
|
|
|
+ call assert_equal( 'cpp', &ft )
|
|
|
+ call WaitForAssert( {-> assert_equal( 1, len( sign_getplaced() ) ) } )
|
|
|
+ call setline( 1, '' )
|
|
|
+ doautocmd TextChanged
|
|
|
+ call WaitForAssert( {-> assert_true( empty( sign_getplaced() ) ) }, 10000 )
|
|
|
+ call assert_true( empty( getloclist( 0 ) ) )
|
|
|
%bwipeout!
|
|
|
-endfunctio
|
|
|
+endfunction
|